in reply to Tk:: Graph menu not working to change the type of graph
A couple of suggestions:
First, please include the entire program. What you've supplied is apparently only subroutines; there is no use Tk, nor use Tk::Graph, and no program main from which any of the subroutines are called.
Secondly, please provide a program which *works*. When I make the assumption that you're trying to call reportg(), I get the following:
#!/usr/bin/perl use Tk; use Tk::Graph; reportg(); # The rest of your code as you provided it... # # Output # Tk::Error: Can't set -variable to `undef' for Tk::Graph=HASH(0x84c9780 +): Tie::Watch::new(): -variable is required. at /usr/lib/perl5/site_p +erl/5.8.0/Tk/Graph.pm line 1088 at /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Tk/Derived. +pm line 294 Tk callback for . Tk::Derived::configure at /usr/lib/perl5/site_perl/5.8.0/i386-linux-t +hread-multi/Tk/Derived.pm line 306 main::reportg at x line 72 ERROR in Tk::Graph:Tk::Graph::set #947: Option '-type' is incorrect! ( +) at /usr/lib/perl5/site_perl/5.8.0/Tk/Graph.pm line 1802. Can't set -variable to `undef' for Tk::Graph=HASH(0x84c9780): Tie::Wat +ch::new(): -variable is required. at /usr/lib/perl5/site_perl/5.8.0/T +k/Graph.pm line 1088 at /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Tk/Derived. +pm line 294
Thirdly, please put the following statements at or near the top of your code:
use strict; use warnings;
They will alert you to variables which have not been declared, which is a GOOD THING!
For example, when I did that to your program, I needed to then define the following variables (under the section "Global data"):
#!/usr/bin/perl # Use Strict! Use Warnings! #use strict; #use warnings; # Libraries use Tk; use Tk::Graph; # Global data #my $data; #my $MW; #my $total_user_job_count; #my $usage; #my $ca; #my $typ; #my $field; # Main program reportg();
Once you provide a working example which anyone else can run, to get the errors you describe, it will be much easier to identify your problem!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Tk:: Graph menu not working to change the type of graph
by wishartz (Beadle) on Sep 27, 2006 at 15:36 UTC | |
by jdtoronto (Prior) on Sep 27, 2006 at 16:50 UTC |