X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FAction%2FDeserialize%2FXML%2FSimple.pm;h=17d23134fd22b5b8fb5d76d398b4da6d2a18257f;hb=1f22d6b363c1287923ac8333ebc67b6d0d735786;hp=246aa99779b92d61e59c5870c5b3306a7d2cc2d6;hpb=f465980c3c25b475d878716b7341d0a4f5c8f823;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 246aa99..17d2313 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.81'; +our $VERSION = '0.97'; $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;