Skip to content

Commit

Permalink
Port Serialize classes except for View.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Rodland authored and bobtfish committed Dec 19, 2009
1 parent 878b2b5 commit 7f36b63
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 30 deletions.
10 changes: 2 additions & 8 deletions lib/Catalyst/Action/Serialize/Data/Serializer.pm
Expand Up @@ -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;
}
Expand Down
8 changes: 1 addition & 7 deletions lib/Catalyst/Action/Serialize/JSON.pm
Expand Up @@ -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;
}
Expand Down
10 changes: 2 additions & 8 deletions lib/Catalyst/Action/Serialize/XML/Simple.pm
Expand Up @@ -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,);

Expand All @@ -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;
}
Expand Down
8 changes: 1 addition & 7 deletions lib/Catalyst/Action/Serialize/YAML.pm
Expand Up @@ -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;
}
Expand Down

0 comments on commit 7f36b63

Please sign in to comment.