Fix ESI plugin, update Makefile.PL
[catagits/Catalyst-View-Component-SubInclude.git] / lib / Catalyst / View / Component / SubInclude / ESI.pm
index 5af70c1..6d763e1 100644 (file)
@@ -8,11 +8,11 @@ Catalyst::View::Component::SubInclude::ESI - Edge Side Includes (ESI) plugin for
 
 =head1 VERSION
 
-Version 0.01
+Version 0.02
 
 =cut
 
-our $VERSION = '0.01';
+our $VERSION = '0.02';
 
 =head1 SYNOPSIS
 
@@ -53,10 +53,14 @@ common interface for plugins.
 =cut
 
 sub generate_subinclude {
-    my $class = shift;
-    my $c     = shift;
-    my $url = $c->uri_for( @_ );
-    return '<!--esi <esi:include src="' . $url->path . '" /> -->';
+    my ($class, $c, $path, @params) = @_;
+
+    my $dispatcher = $c->dispatcher;
+    my ($action, $args) = $dispatcher->_invoke_as_path( $c, $path, @params );
+
+    my $uri = $c->uri_for( $action, $args );
+
+    return '<!--esi <esi:include src="' . $uri->path . '" /> -->';
 }
 
 =head1 SEE ALSO