in reply to Converting Unix to NT

Three quick tips -- warnings, strict, and diagnostics. Perl has the ability to diagnose some dodgy programming practices. It's pretty good at helping you discover what's wrong. Your script should start out something like this:
#!/usr/bin/perl -w use strict; use diagnostics;
On NT, you may have to call it with the command perl -w scriptname so the warning goes into effect.

You'll probably end up with pages full of things to check. Log them to a file and do what they recommend.

Replies are listed 'Best First'.
RE: Re: Converting Unix to NT
by Anonymous Monk on Aug 24, 2000 at 04:16 UTC
    Thanks. Cool. So here's what I got: CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: Global symbol "$q" requires explicit package name at e:\inetpub\awesomelibrary.net\cgi-bin\awesome.pl line 132. Global symbol "$sess_id" requires explicit package name at e:\inetpub\awesomelibrary.net\cgi-bin\awesome.pl line 134. Global symbol "$usr_name" requires explicit package name at e:\inetpub\awesomelibrary.net\cgi-bin\awesome.pl line 136. Global symbol "$password" requires explicit package name at e:\inetpub\awesomelibrary.net\cgi-bin\awesome.pl line 137. Global symbol "$PATH" requires explicit package name at e:\inetpub\awesomelibrary.net\cgi-bin\awesome.pl line 140. Global symbol "$MAIN_PANEL" requires explicit package name at e:\inetpub\awesomelibrary.net\cgi-bin\awesome.pl line 150. Global symbol "$TEMPLATE" requires explicit package name at e:\inetpub\awesomelibrary.net\cgi-bin\awesome
      Aha. What you need to do is tell Perl that you want to use these variables. Generally, that's done something like this:
      #!/usr/bin/perl -wT # or #!c:/perl/bin/perl -wT use strict; my $q; my $sess_id; my $usr_name; my $password;
      and so forth. If you're familiar with scoping rules in another language, you'll find that Perl is pretty similar.
        If there is any chance that you will want to run this using mod_perl, it is important to change those declarations to:
        use vars qw ( $q $sess_id $usr_name $password );
        I tried to explain why at RE (3): BrainPain-Help, don't think I succeeded. If someone wants to give me feedback on how to improve that description, I would appreciate it....

        EDIT
        Note that the mod_perl issue is likely to be an issue with other "fast CGI" type approaches like FastCGI and ASP. The underlying problem is not Apache/mod_perl, it is with how Perl names things.

RE: Re: Converting Unix to NT
by Anonymous Monk on Aug 24, 2000 at 05:21 UTC
    COOL! I'm actually making progress. Disregard last message... got through that one and working through some more warnings and the page half-loads now.