r1144@mbp: claco | 2008-01-03 19:43:42 -0500
[catagits/Catalyst-Action-Serialize-Data-Serializer.git] / lib / Catalyst / Action / Serialize / XML / Simple.pm
index de297d2..aed9561 100644 (file)
@@ -20,12 +20,17 @@ sub execute {
         require XML::Simple
     };
     if ($@) {
-        $c->log->debug("Could not load XML::Serializer, refusing to serialize: $@");
+        $c->log->debug("Could not load XML::Serializer, refusing to serialize: $@")
+            if $c->debug;
         return 0;
     }
     my $xs = XML::Simple->new(ForceArray => 0,);
 
-    my $stash_key = $controller->config->{'serialize'}->{'stash_key'} || 'rest';
+    my $stash_key = (
+            $controller->config->{'serialize'} ?
+                $controller->config->{'serialize'}->{'stash_key'} :
+                $controller->config->{'stash_key'} 
+        ) || 'rest';
     my $output;
     eval {
         $output = $xs->XMLout({ data => $c->stash->{$stash_key} });