[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] syntax checks and taint



Chris Nandor wrote:
> 
> At 14.04 -0400 1999.04.20, Matthew Wickline wrote:
> >I've got a three line script that's bothering me:
> >
> >#!/usr/bin/perl -Tw
> >#!C:/Perl/bin/perl.exe -Tw
> >exit;
> >
> >If I syntax check that I get "too late for -T"
> >However, if I switch the order of the first two lines, I get
> >no errors.
> 
> When you do that, MacPerl does not recognize the -T at all, so that's why
> you don't get a warning.  :)
> 
> >MacPerl is set to check the #! line.
> >MacPerl version is 5.2.0r4
> >
> >anyone know what's going on here? I'm on digest and curious
> >enough that an email CC of any responses would be
> >appreciated as it would help me figure it out that much
> >faster :)
> 
> It is complicated to explain (we tried to do it in the CGI Script chapter
> of the book), but the bottom line is that you have to use the Taint Checks
> menu item.  If you send the script to MacPerl through Apple events, you can
> enable taint checks in the Apple events (I forget the syntax).  For CGI
> Scripts, you can use the special CGI Script (Taint Check) extension on my
> site.
> 

Also, note that this error message is not specific to MacPerl.  You
can get it on Unix with the following:

~> cat > foo
#!/usr/local/bin/perl -T
print "Hello world.\n";
~> perl foo
Too late for "-T" option at foo line 1.
~> 

This is because perl has to do taint checking from the start.  In
the above example, perl didn't know it was supposed to do
taint-checking until it parsed the #! line and found the -T.


Either of the following works:

~> perl -T foo
Hello world.
~> 

which is pretty straightforward, or:

~> chmod +x foo
~> ./foo
Hello world.
~> 

In that example, the shell handles the #! line, and executes perl
with the -T switch.


Setting the 'Taint Checks' menu item in MacPerl is equivalent to the first
solution.

Ronald

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org