Change all classes to Moose
[catagits/Catalyst-Action-REST.git] / lib / Catalyst / Action / Serialize / JSON.pm
index 561b49b..d4b12df 100644 (file)
@@ -1,16 +1,9 @@
-#
-# Catlyst::Action::Serialize::JSON.pm
-# Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
-# Created on: 10/12/2006 03:00:32 PM PDT
-#
-# $Id$
-
 package Catalyst::Action::Serialize::JSON;
 
-use strict;
-use warnings;
+use Moose;
+use namespace::autoclean;
 
-use base 'Catalyst::Action';
+extends 'Catalyst::Action';
 use JSON qw(encode_json);
 
 sub execute {
@@ -24,7 +17,7 @@ sub execute {
         ) || 'rest';
     my $output;
     eval {
-        $output = encode_json( $c->stash->{$stash_key} );
+        $output = $self->serialize( $c->stash->{$stash_key} );
     };
     if ($@) {
         return $@;
@@ -33,4 +26,9 @@ sub execute {
     return 1;
 }
 
+sub serialize {
+    my $self = shift;
+    encode_json( shift );
+}
+
 1;