Port Serialize classes except for View.
Andrew Rodland [Fri, 4 Dec 2009 02:04:59 +0000 (20:04 -0600)]
lib/Catalyst/Action/Serialize/Data/Serializer.pm
lib/Catalyst/Action/Serialize/JSON.pm
lib/Catalyst/Action/Serialize/XML/Simple.pm
lib/Catalyst/Action/Serialize/YAML.pm

index ca42ce7..c58d192 100644 (file)
@@ -23,16 +23,10 @@ sub execute {
     };
     if ($@) {
         $c->log->info("Could not load $serializer, refusing to serialize: $@");
-        return 0;
+        return;
     }
     my $dso = Data::Serializer->new( serializer => $serializer );
-    my $data;
-    eval {
-       $data = $dso->raw_serialize($c->stash->{$stash_key});
-    };
-    if ($@) {
-        return $@;
-    } 
+    my $data = $dso->raw_serialize($c->stash->{$stash_key});
     $c->response->output( $data );
     return 1;
 }
index d4b12df..c462e58 100644 (file)
@@ -15,13 +15,7 @@ sub execute {
                 $controller->{'serialize'}->{'stash_key'} :
                 $controller->{'stash_key'} 
         ) || 'rest';
-    my $output;
-    eval {
-        $output = $self->serialize( $c->stash->{$stash_key} );
-    };
-    if ($@) {
-        return $@;
-    }
+    my $output = $self->serialize( $c->stash->{$stash_key} );
     $c->response->output( $output );
     return 1;
 }
index a562078..a367596 100644 (file)
@@ -15,7 +15,7 @@ sub execute {
     if ($@) {
         $c->log->debug("Could not load XML::Serializer, refusing to serialize: $@")
             if $c->debug;
-        return 0;
+        return;
     }
     my $xs = XML::Simple->new(ForceArray => 0,);
 
@@ -24,13 +24,7 @@ sub execute {
                 $controller->{'serialize'}->{'stash_key'} :
                 $controller->{'stash_key'} 
         ) || 'rest';
-    my $output;
-    eval {
-        $output = $xs->XMLout({ data => $c->stash->{$stash_key} });
-    };
-    if ($@) {
-        return $@;
-    }
+    my $output = $xs->XMLout({ data => $c->stash->{$stash_key} });
     $c->response->output( $output );
     return 1;
 }
index 911191b..c3f9003 100644 (file)
@@ -15,13 +15,7 @@ sub execute {
                 $controller->{'serialize'}->{'stash_key'} :
                 $controller->{'stash_key'} 
         ) || 'rest';
-    my $output;
-    eval {
-        $output = $self->serialize($c->stash->{$stash_key});
-    };
-    if ($@) {
-        return $@;
-    }
+    my $output = $self->serialize($c->stash->{$stash_key});
     $c->response->output( $output );
     return 1;
 }