in reply to Unexpected errors using multiple TopLevel's in Perl/Tk

I thought that I would point out a few things.
  1. Either add -w to the shebang line or use warnings;. $^W++; isn't gonna do what you think in this case.
  2. Module names are case sensitive. Try use Tk::Toplevel; and $tlu = $mainwindow->Toplevel();. (Note the lowercase l's in Toplevel)

Added: Try this example:

#!/usr/bin/perl $^W++; my $text = "blah"; print "$test\n";
It doesn't produce any warnings. Why? Because warnings are generated at compile time not run time. Remove the $^W++; and add -w to the shebang line and run it again. It works now, see? Name "main::test" used only once: possible typo at w.pl line 3.

Replies are listed 'Best First'.
Re: Re: Unexpected errors using multiple TopLevel's in Perl/Tk
by jdtoronto (Prior) on Jul 28, 2003 at 23:07 UTC
    See, I told you it would be something simple.

    Thanks Mr Muskrat!

    I have been staring at the various parts of the code for this application since 7:30am and I think I needed a break. As soon as I saw your comment I realised what I had done.

    Thanks also for the warning about $^W++ - I am not sure where I picked that one up, but I will go have a look at the documentation. I have changed this script to use -w on the shebang line.

    ...john