in reply to File does not exist: 500 read failed

Unsuccessful stat on filename containing newline...

This means that the XML::Simple module is taking your $som variable and assumes that it is a file path because it is invalid XML.

You need to validate the data that receive from the API service. A simple solution would be,

use English qw( -no_match_vars ); my $result; eval { $result = XMLin($som); } if ($EVAL_ERROR) { die "Invalid XML retrieved. The error was " . $EVAL_ERROR . "\n"; }

Also don't refer to internal values for a object ESPECIALLY when it already has an interface!

## GOOD my $som=$response->content; ## BAD!!! my $som=$response->{'_content'};

Replies are listed 'Best First'.
Re^2: File does not exist: 500 read failed
by CColin (Scribe) on Dec 07, 2007 at 16:54 UTC
    Thanks. Speed is of the essence on this service, will using "eval" put any sort of time overhead on the function? Colin

      Inappropriately named eval BLOCK is very different from eval EXPR.
      eval EXPR invokes the Perl parser to parse and execute EXPR. This should be avoided whenever possible.
      eval BLOCK, the function used in the parent, is the benign construct known as try in other languages.

      See eval.