Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2003
    Posts
    13

    Unanswered: Newbie needs help

    I was doing a perl/tk program and I realize I didn't have "use strict;" in my code. When I added it, I got this error message:

    Name "main::address" used only once: possible typo at sorcerer.pl line 26.
    Not a reference 0 at C:/Perl/site/lib/Tk/Widget.pm line 188.
    Tk::Widget::new('Tk::Radiobutton', 'Tk::Frame=HASH(0x240f2b8)', '-variab
    le', 0, '-command', 'ARRAY(0x234f2e0)', '-text', 'Calling My Opponent At', ...)
    called at C:/Perl/site/lib/Tk/Widget.pm line 247
    Tk::Widget::__ANON__('Tk::Frame=HASH(0x240f2b8)', '-variable', 0, '-comm
    and', 'ARRAY(0x234f2e0)', '-text', 'Calling My Opponent At', '-value', ...) call
    ed at C:/Perl/site/lib/Tk/DialogBox.pm line 74
    Tk:ialogBox::add('Tk:ialogBox=HASH(0x24128c4)', 'Radiobutton', '-var
    iable', 0, '-command', 'ARRAY(0x234f2e0)', '-text', 'Calling My Opponent At', ..
    .) called at sorcerer.pl line 115

    The source code is attached. I think the problem is somewhere in this area, though.

    our @connecttype;
    our $type = 0;
    $connecttype[0] = $connect -> add( 'Radiobutton',
    -variable => $type,
    -command => [\&chgType, $type],
    -text => 'Calling My Opponent At',
    -value => 0,
    ) -> place ( -relx => 0.0,
    -x => 10,
    -rely => 0.0,
    -y => 10,
    );
    $connecttype[1] = $connect -> add( 'Radiobutton', -variable => $type,
    -command => [\&chgType, $type],
    -text => 'Waiting For A Call',
    -value => 1,
    ) -> place ( -relx => 0.0,
    -x => 10,
    -rely => 0.0,
    -y => 40,
    );

    Do you know what the problem is?
    Thanks in advance
    Attached Files Attached Files

  2. #2
    Join Date
    Aug 2003
    Posts
    13
    oops, the smilies are supposed to be :D

  3. #3
    Join Date
    Aug 2003
    Posts
    11
    use strict forces you to be using more appropriate code and makes the interpreter recognise a more "strict" syntax, your code then doesnt adhere to that syntax. Make sure its all done well (and indented so you can see what your doing well).

    From my little knowlege of tk, isnt the -command attribute only supposed to take one arguement?, and shouldnt it be pack() instead of place() ?

  4. #4
    Join Date
    Aug 2003
    Posts
    13
    I figured out the problem, it was with the lack of a \ in front of the $type. Place is a more specific version of pack and the first argument of command is the sub to call and the second is the argument to pass to the sub. Now I have most of the problems fixed. However, I am making a at program and IO:elect doesn't work to keep it from not responding to the GUI. Actually, I am using Active State Perl 5.8.0 for Win32 and IO:elect doesn't seem to work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •