Subject: | Graph::Easy::Parser error return |
Date: | Wed, 20 May 2015 19:41:23 +1000 |
To: | bug-Graph-Easy [...] rt.cpan.org |
From: | Kevin Ryde <user42_kevin [...] yahoo.com.au> |
In recent debian Graph::Easy 0.75, a bit of code
use Graph::Easy::Parser;
my $parser = Graph::Easy::Parser->new (fatal_errors => 0);
my $graph = $parser->from_text('bogus');
print defined $graph ? $graph : "undef", "\n";
prints
Graph::Easy=HASH(0x89d6560)
but the Graph::Easy::Parser docs under from_text() say
Returns undef for error, you can find out what the error was with
error().
which made me think the code would print undef.
I suppose the code behaviour could be justified by reckoning it gives as
much of the input as it could successfully read, when fatal_errors is
false.
Either way the docs could note the return is for fatal_errors false,
since of course for the default fatal_errors true croaks.