Skip Menu |

This queue is for tickets about the Graph CPAN distribution.

Report information
The Basics
Id: 79143
Status: resolved
Priority: 0/
Queue: Graph

People
Owner: Nobody in particular
Requestors: SJCARBON [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



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"; }
This is actually easily fixable by addition a "bool" overload, which for graphs returns always true.