X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FAction%2FDeserialize%2FXML%2FSimple.pm;h=f7843c21c84696173fd6cba9967ee66e5010bdab;hb=40de934ce925aa9fbf1d2fa15846b5c0de9ec790;hp=b43d026a81124554dc026230b23e739cbc547b29;hpb=e527bba30dcea5108b0fb77416fcb4e8ee1e5a38;p=catagits%2FCatalyst-Action-REST.git diff --git a/lib/Catalyst/Action/Deserialize/XML/Simple.pm b/lib/Catalyst/Action/Deserialize/XML/Simple.pm index b43d026..f7843c2 100644 --- a/lib/Catalyst/Action/Deserialize/XML/Simple.pm +++ b/lib/Catalyst/Action/Deserialize/XML/Simple.pm @@ -2,10 +2,11 @@ package Catalyst::Action::Deserialize::XML::Simple; use Moose; use namespace::autoclean; +use Scalar::Util qw(openhandle); extends 'Catalyst::Action'; -our $VERSION = '0.87'; +our $VERSION = '1.01'; $VERSION = eval $VERSION; sub execute { @@ -26,7 +27,10 @@ sub execute { my $xs = XML::Simple->new('ForceArray' => 0,); my $rdata; eval { - $rdata = $xs->XMLin( "$body" ); + if(openhandle $body){ # make sure we rewind the file handle + seek($body, 0, 0); # in case something has already read from it + } + $rdata = $xs->XMLin( $body ); }; if ($@) { return $@; @@ -44,4 +48,6 @@ sub execute { return 1; } +__PACKAGE__->meta->make_immutable; + 1;