Eric replied:

I thought you always had to have the shebang line.  So, I took the shebang line out of the windows version of my program, and it worked.  I also added ‘use strict’.  All worked fine, no warnings.

When I ran the CGI version of my program on Apache it didn’t like it.  Apache wants that shebang line.  But, again I added ‘use strict’ and all worked fine. 

I think Apache works sort of like Unix/Linux on Windows.

Thanks for the info.  Very informative!

Eric

 

 John Deighan wrote:

 

At 12:05 AM 7/24/2006, Chris Wagner wrote:

It's better to not use strict or use no strict vars.  undef is a perfectly
legitimate variable value.


Bad advice - you should always "use strict".

More importantly, the problem is not "use strict", but "use warnings". In this case, I assume that it's being picked up from the '-w' on the shebang line (i.e. '
#!/usr/bin/perl -w'). The fact that your data is coming from a database also has nothing to do with the problem. I do all my programming under Windows (not so much by choice), so I never use a shebang line, but you can try the following to see what I mean (if you need to have a shebang line, remove the -w first):

my @values = ('1', undef, '2');
print(@values, "\n");

use strict;
my @values = ('1', undef, '2');
print(@values, "\n");

use strict;
use warnings;
my @values = ('1', undef, '2');
print(@values, "\n");

use strict;
use warnings;
no warnings 'uninitialized';
my @values = ('1', undef, '2');
print(@values, "\n");

You'll find that only the third one - with the "use warnings" but not "no warnings 'uninitialized'", causes the warning "Use of uninitialized value...". Note that you can selectively turn off certain warnings, as in the fourth version. That's what I'd recommend, though you'll probably find yourself turning off several different warnings before you get the best setup.

The best source for what the possible warnings are, and how to turn individual ones off, is the perldiag man page. If you're using ActivePerl for Windows, open a browser, and in it, open the file c:\Perl\html\index.html (modify the path according to where you installed Perl). Then, find 'perldiag' in the menu on the left. It lists all warning messages, and the identifier to use with "no warnings" to turn it off.

Perhaps someone who uses Linux/Unix can post how to get to this page, perhaps something like "man perldiag" or "man perl perldiag"?


At 07:53 PM 7/23/2006 -0500, Eric Edwards wrote:
>Eric Edwards replied:
>Charles,
>That was the problem.  In my table there is one field that is blank a lot of
>the time and it showed as 'undef' when I ran the 'Dumper'.
>So, I added a default value to that field and the warning did not come up.





--
REMEMBER THE WORLD TRADE CENTER         ---=< WTC 911 >=--
"...ne cede malis"

00000100

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Scanned for Spam and Viruses.
PCG Information Technology Services.

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to