Hi wishartz,

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!


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

In reply to Re: Tk:: Graph menu not working to change the type of graph by liverpole
in thread Tk:: Graph menu not working to change the type of graph by wishartz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.