Fix some issues with Args/Captures in the SubRequest and Visit plugins and add more...
[catagits/Catalyst-View-Component-SubInclude.git] / t / ESITest / lib / ESITest / Controller / Root.pm
index 78b78c8..a19c771 100644 (file)
@@ -32,7 +32,7 @@ sub time_include : Chained('base') PathPart('time') Args(0) {
 sub capture : Chained('base') PathPart('') CaptureArgs(1) {
     my ( $self, $c, $arg ) = @_;
     $c->log->debug("Capture: $arg");
-    $c->stash->{additional} = "Arg: $arg";
+    $c->stash->{additional} = "Capture Arg: $arg";
 }
 
 sub time_args : Chained('capture') PathPart('time') Args(0) {
@@ -51,6 +51,42 @@ sub time_args : Chained('capture') PathPart('time') Args(0) {
     $c->stash->{template} = 'time_include.tt';
 }
 
+sub time_args_with_args : Chained('capture') PathPart('time') Args(1) {
+    my ( $self, $c, $arg ) = @_;
+    my $params = $c->req->params;
+
+    $c->stash->{current_time} = localtime();
+
+    my $additional = $c->stash->{additional};
+    for my $key (keys %$params) {
+        $additional .= " | $key = $params->{$key} | "
+    }
+
+    $additional .= " Action Arg: $arg ";
+
+    $c->stash->{additional} = $additional;
+
+    $c->stash->{template} = 'time_include.tt';
+}
+
+sub time_args_without_capture : Chained('base') PathPart('time') Args(1) {
+    my ( $self, $c, $arg ) = @_;
+    my $params = $c->req->params;
+
+    $c->stash->{current_time} = localtime();
+
+    my $additional = '';
+    for my $key (keys %$params) {
+        $additional .= " | $key = $params->{$key} | "
+    }
+
+    $additional .= " Action Arg: $arg ";
+
+    $c->stash->{additional} = $additional;
+
+    $c->stash->{template} = 'time_include.tt';
+}
+
 sub end : ActionClass('RenderView') {}
 
 1;