I'm experienced with Perl CGI coding for a linux server. Now I'm getting
around to trying Win32::GUI for my Win98 machine (WinGui425.zip).

I've loaded Hello.pl from the tutorial (see script below). Launched it from
a DOS window and it seems to run fine -- the little window pops up and says
Hello.

But if i run it with -w in the HashBang line, I get a series of warnings in
the DOS window saying:

        Use of uninitialized value at HelloGui.pl line 19.

Line 19 is:

        Win32::GUI::Dialog();

Similar warnings for lines containing Win32::GUI::Dialog(); have been
obtained with other sample programs.

In my previous experience this warning usually means that a variable is
being used that has had no value assigned to it. The docs on GUI::Dialog()
are clear: Dialog() should not be invoked with any parameters. And the
Dialog() doc page gives no hint of any potential problem here.

So maybe something that should have been set up in one of the previous lines
is only coming to light when the line in question occurs...

Can someone explain this warning and how to prevent it? URL doc references,
RTFM's, etc, gladly accepted.

david
____________________________________________

Here's the whole script:

#!/usr/bin/perl5 -w
use strict;
use Win32::GUI;

my ($text,$main,$label,$ncw,$nch,$w,$h);

$text = defined($ARGV[0]) ? $ARGV[0] : "Hello, world";

$main = Win32::GUI::Window->new(-name => 'Main', -text => 'Perl');
$label = $main->AddLabel(-text => $text);

$ncw = $main->Width() - $main->ScaleWidth();
$nch = $main->Height() - $main->ScaleHeight();
$w = $label->Width() + $ncw;
$h = $label->Height() + $nch;

$main->Resize($w, $h);
$main->Show();
Win32::GUI::Dialog();

sub Main_Terminate {
    -1;
}


Reply via email to