Skip Menu |

This queue is for tickets about the Graph-Easy CPAN distribution.

Report information
The Basics
Id: 33363
Status: resolved
Worked: 11 min
Priority: 0/
Queue: Graph-Easy

People
Owner: TELS [...] cpan.org
Requestors: dhorne [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.60
Fixed in: (no value)



Subject: Set attribute when can't place all nodes or edges
If the Layouter can't place all of the edges or nodes, it generatedsthe warning: "Layouter could only place $nodes nodes/$edges edges out of $e_nodes/$e_edges - giving up." If this specific warning set an attribute, then we could check for it and take appropriate action in the context of our app: if ($graph->cannot_layout) { print "We cannot show this graph, showing the results in a atablualr format:\n"; ...etc... } else { print $graph->as_html; }
On Sun Feb 17 19:17:50 2008, DHORNE wrote: Show quoted text
> If the Layouter can't place all of the edges or nodes, it generatedsthe > warning: "Layouter could only place $nodes nodes/$edges edges out of > $e_nodes/$e_edges - giving up." > > If this specific warning set an attribute, then we could check for it > and take appropriate action in the context of our app: > > if ($graph->cannot_layout) { > print "We cannot show this graph, showing the results in a atablualr > format:\n"; > ...etc... > } else { > print $graph->as_html; > }
I *think* this should be possible already by quering the warnings() method like so: my $graph = Graph::Easy->new(); $graph->catch_warnings(1); ... $graph->layout(); my $warnings = $graph->warnings(); if (@$warnings > 0) { #... do something } The methods "catch_warnings()" and "warnings()" are documented in Graph::Easy::Base, so they are easily to miss. If this doesn't do exactly what you want, I can easily add something, just tell me what you need :)
Should be: my $graph = Graph::Easy->new(); $graph->catch_warnings(1); # ... $graph->layout(); my @warnings = $graph->warnings(); if (@warnings > 0) { #... do something }
I am marking this report as resolved, if you still have problems that aren't solved by this solution, just reply to this email and reopen the ticket. Thank you for your report!