Fix failing test. Normalize method names
Tomas Doran (t0m) [Mon, 17 Aug 2009 13:04:00 +0000 (14:04 +0100)]
lib/Catalyst/Action/Serialize/JSON.pm
lib/Catalyst/Action/Serialize/JSON/XS.pm
lib/Catalyst/Action/Serialize/YAML.pm

index 3b8e511..7423e9e 100644 (file)
@@ -24,7 +24,7 @@ sub execute {
         ) || 'rest';
     my $output;
     eval {
-        $output = $self->encode( $c->stash->{$stash_key} );
+        $output = $self->serialize( $c->stash->{$stash_key} );
     };
     if ($@) {
         return $@;
@@ -33,7 +33,7 @@ sub execute {
     return 1;
 }
 
-sub encode {
+sub serialize {
     my $self = shift;
     encode_json( shift );
 }
index bac66de..b1f4850 100644 (file)
@@ -6,7 +6,7 @@ use warnings;
 use base 'Catalyst::Action::Serialize::JSON';
 use JSON::XS qw(encode_json);
 
-sub encode {
+sub serialize {
     my $self = shift;
     encode_json( shift );
 }
index c943569..4879af9 100644 (file)
@@ -24,7 +24,7 @@ sub execute {
         ) || 'rest';
     my $output;
     eval {
-        $output = Dump($c->stash->{$stash_key});
+        $output = $self->serialize($c->stash->{$stash_key});
     };
     if ($@) {
         return $@;
@@ -33,4 +33,10 @@ sub execute {
     return 1;
 }
 
+sub serialize {
+    my $self = shift;
+    my $data = shift;
+    Dump($data);
+}
+
 1;