X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FAction%2FDeserialize%2FXML%2FSimple.pm;h=18b9c7026d6f1eb1295951ebf04d34e0d3ec979e;hb=3ed677b16323396b3479e6f32db337381665d653;hp=03057e5923a1c9eefc8d10a6d5f9453da998ce65;hpb=2474828604a779657c1bfa42b1875951ccd43383;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 03057e5..18b9c70 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.88'; +our $VERSION = '0.99'; $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 $@;