Fixes for Mojolicious 7
authorVincent Tondellier <tonton+hg@team1664.org>
Sat, 29 Oct 2016 13:20:07 +0200
changeset 114 1f67942c76c9
parent 113 fa0ec89bf0af
child 115 a092dd98e34d
Fixes for Mojolicious 7
dist.ini
lib/CrashTest/Plugin/StackFilter/FileLink.pm
--- a/dist.ini	Mon Feb 22 22:58:40 2016 +0100
+++ b/dist.ini	Sat Oct 29 13:20:07 2016 +0200
@@ -28,7 +28,7 @@
 format = %-9v %{yyyy-MM-dd}d
 
 [Prereqs]
-Mojolicious = 6.00
+Mojolicious = 7.00
 Mojolicious::Plugin::BootstrapPagination = 0.12
 Mojolicious::Plugin::InstallablePaths = 0.04
 UUID = 0.0.3
--- a/lib/CrashTest/Plugin/StackFilter/FileLink.pm	Mon Feb 22 22:58:40 2016 +0100
+++ b/lib/CrashTest/Plugin/StackFilter/FileLink.pm	Sat Oct 29 13:20:07 2016 +0200
@@ -54,19 +54,14 @@
     $self->app->log->debug("Building template for $linkconf");
 
     my $mt = Mojo::Template->new
+        ->vars(1)
         ->prepend('my ($repo, $scmpath, $rev, $line) = @_;')
         ->auto_escape(1)
         ->escape(sub {
             my $str = shift;
             return Mojo::ByteStream::b($str)->url_escape;
         })
-        ->parse($template)
-        ->build;
-    my $e = $mt->compile;
-    if($e) {
-        $self->app->log->error($e);
-        return undef;
-    }
+        ->parse($template);
 
     $self->{_template_cache}->{$linkconf} = $mt;
     return $mt;
@@ -86,7 +81,7 @@
         my $template = $self->_link_template($scm, $repo);
         if(defined($template)) {
             # build url using the configured template
-            my $url = $template->interpret($repo, $scmpath, $rev, $line);
+            my $url = $template->process({ repo => $repo, scmpath => $scmpath, rev => $rev, line => $line });
             # and create a link to it
             return $self->app->link_to("$filename:$line" => $url);
         }