Subject: | Graph scalar context override causes problems |
I have been getting a lot of use out of this module so far--thank you!
However, it seems to be that the scalar context override (for printing),
while nice in a lot of situations, can cause problems when working with
a possibly empty graph (to the extent that some standard perl idioms fail).
A possible fix would be to have no override when the graph is empty, or
and empty indicator.
A test case for the problem is attached.
Once the problem is recognized, it can be coded around it, so an even
more light fix would just be to document this issue.
Subject: | bug.pl |
use Graph;
my $g = Graph->new();
process_graph($g);
sub process_graph {
my $g = shift || die 'need an arg!';
print $g . "\n";
}