X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FAction%2FDeserialize%2FXML%2FSimple.pm;h=b7f5c76171ea7d893f4f4e0ef397e90924732642;hb=44fa7f9429568532ea892e2020c20177b71cb736;hp=2ce18038bd97cb512c5988417248579d46837211;hpb=48ff1e96cc8ba24cd9e7bea3a2cfc145e827dd52;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 2ce1803..b7f5c76 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.90'; +our $VERSION = '1.04'; $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 $@;