Cherry pick everything bar the use parent change from 25d49c2, fixing RT#46680
[catagits/Catalyst-Action-REST.git] / lib / Catalyst / Action / Serialize / Data / Serializer.pm
index 7297fcd..9c6cad6 100644 (file)
@@ -1,9 +1,3 @@
-#
-# Catalyst::Action::Serialize::Data::Serializer
-# Created by: Adam Jacob, Marchex, <adam@marchex.com>
-#
-# $Id$
-
 package Catalyst::Action::Serialize::Data::Serializer;
 
 use strict;
@@ -16,7 +10,11 @@ sub execute {
     my $self = shift;
     my ( $controller, $c, $serializer ) = @_;
 
-    my $stash_key = $controller->config->{'serialize'}->{'stash_key'} || 'rest';
+    my $stash_key = (
+            $controller->{'serialize'} ?
+                $controller->{'serialize'}->{'stash_key'} :
+                $controller->{'stash_key'} 
+        ) || 'rest';
     my $sp = $serializer;
     $sp =~ s/::/\//g;
     $sp .= ".pm";
@@ -24,7 +22,7 @@ sub execute {
         require $sp
     };
     if ($@) {
-        $c->log->debug("Could not load $serializer, refusing to serialize: $@");
+        $c->log->info("Could not load $serializer, refusing to serialize: $@");
         return 0;
     }
     my $dso = Data::Serializer->new( serializer => $serializer );