r49@latte: adam | 2006-12-03 12:30:40 -0800
[catagits/Catalyst-Action-REST.git] / lib / Catalyst / Action / Serialize / YAML.pm
index ec328ca..3856250 100644 (file)
@@ -15,10 +15,17 @@ use YAML::Syck;
 
 sub execute {
     my $self = shift;
-    my ( $controller, $c, $test ) = @_;
+    my ( $controller, $c ) = @_;
 
-    my $stash_key = $controller->serialize->{'stash_key'} || 'rest';
-    $c->response->output( Dump( $c->stash->{$stash_key} ) );
+    my $stash_key = $controller->config->{'serialize'}->{'stash_key'} || 'rest';
+    my $output;
+    eval {
+        $output = Dump($c->stash->{$stash_key});
+    };
+    if ($@) {
+        return $@;
+    }
+    $c->response->output( $output );
     return 1;
 }