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=2e53359079e2b090cb0a2df268f06c764cd2ba55;hpb=3bb36dcaabf34fef5c15b1bb74c5eb198a7f5168;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 2e53359..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.82'; +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 $@; @@ -44,4 +48,6 @@ sub execute { return 1; } +__PACKAGE__->meta->make_immutable; + 1;