mojo 6.x compat
This commit is contained in:
2
dist.ini
2
dist.ini
@@ -13,7 +13,7 @@ travis_status = 1
|
|||||||
installer = ModuleBuild
|
installer = ModuleBuild
|
||||||
|
|
||||||
[Prereqs]
|
[Prereqs]
|
||||||
Mojolicious = 3.33
|
Mojolicious = 5.81
|
||||||
Template = 2.18
|
Template = 2.18
|
||||||
|
|
||||||
[Author::Plicease::Thanks]
|
[Author::Plicease::Thanks]
|
||||||
|
|||||||
@@ -206,9 +206,8 @@ sub _template_content {
|
|||||||
if(defined $options) {
|
if(defined $options) {
|
||||||
$data = $self->renderer->get_data_template($options);
|
$data = $self->renderer->get_data_template($options);
|
||||||
} else {
|
} else {
|
||||||
my $loader = Mojo::Loader->new;
|
|
||||||
foreach my $class (@{ $self->renderer->classes }) {
|
foreach my $class (@{ $self->renderer->classes }) {
|
||||||
$data = $loader->data($class, $t);
|
$data = Mojo::Loader::data_section($class, $t);
|
||||||
last if $data;
|
last if $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
#!/usr/bin/env perl
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
|
|
||||||
#BEGIN { $ENV{MOJO_MODE}='testing'; };
|
|
||||||
|
|
||||||
use utf8;
|
|
||||||
|
|
||||||
use Test::More;
|
|
||||||
|
|
||||||
use Mojolicious::Lite;
|
|
||||||
use Test::Mojo;
|
|
||||||
use File::Temp qw( tempdir );
|
|
||||||
use File::Spec;
|
|
||||||
|
|
||||||
if($Mojolicious::VERSION >= 4.0)
|
|
||||||
{
|
|
||||||
plan skip_all => 'test broken in mojo 4.0';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plan tests => 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Send log to tmp file so that it doesn't clutter up the screen.
|
|
||||||
app->log->level('fatal');
|
|
||||||
app->log->path(do {
|
|
||||||
File::Spec->catfile(tempdir(CLEANUP => 1), 'mojo.log');
|
|
||||||
});
|
|
||||||
|
|
||||||
plugin 'tt_renderer' => {template_options => { COMPILE_DIR => tempdir( CLEANUP => 1 ) }};
|
|
||||||
|
|
||||||
get '/exception' => sub { die };
|
|
||||||
|
|
||||||
#say app->mode;
|
|
||||||
#app->start;
|
|
||||||
#exit;
|
|
||||||
|
|
||||||
my $t = Test::Mojo->new;
|
|
||||||
|
|
||||||
$t->app->renderer->default_handler('tt');
|
|
||||||
|
|
||||||
my $deep_recursion = 0;
|
|
||||||
|
|
||||||
do {
|
|
||||||
local $SIG{__WARN__} = sub {
|
|
||||||
my $warning = shift;
|
|
||||||
if($warning =~ /Deep recursion/) {
|
|
||||||
$deep_recursion = 1;
|
|
||||||
die $warning;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$t->get_ok('/exception')
|
|
||||||
->status_is(500);
|
|
||||||
};
|
|
||||||
|
|
||||||
ok !$deep_recursion, 'no deep recursion';
|
|
||||||
|
|
||||||
__DATA__
|
|
||||||
|
|
||||||
@@ exception.development.html.tt
|
|
||||||
[% 1 + % %]
|
|
||||||
|
|
||||||
@@ exception.html.tt
|
|
||||||
[% 1 + % %]
|
|
||||||
|
|
||||||
@@ exception.testing.html.tt
|
|
||||||
[% 1 + % %]
|
|
||||||
Reference in New Issue
Block a user