Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > activeperl + -T option

Reply
Thread Tools

activeperl + -T option

 
 
Robin
Guest
Posts: n/a
 
      04-20-2004
I am running active perl 8.2.3 Build 809 and I'm wondering why when I turn
on taint mode checking on the #!/usr/bin/perl line whenver I run the script
it gives me an error "Too late for -T option at bbs.pl line 1." and whenever
I run the script with perl -T bbs.pl it works fine....is there any
configuration file I can edit so perl will automatically understand it to be
run with a -T option? I want to run the script with a Perl IDE that I've
downloaded and it gives me this error unless I take out the -T option. Do I
have to take out the -T evertime I run the script with the IDE or is there
something I can do?
Thanks in advance.

--
Regards,
-Robin
--
[ webmaster @ infusedlight.net ]


 
Reply With Quote
 
 
 
 
Clyde Ingram
Guest
Posts: n/a
 
      04-20-2004
Robin,

"Robin" <robin @ infusedlight.net> wrote in message
news:c62hsr$qci$(E-Mail Removed)...
> I am running active perl 8.2.3 Build 809 and I'm wondering why when I turn
> on taint mode checking on the #!/usr/bin/perl line whenver I run the

script
> it gives me an error "Too late for -T option at bbs.pl line 1." and

whenever
> I run the script with perl -T bbs.pl it works fine


You have not said which platform you are running on.
What you hint at should behave correctly on most UNIX systems.
There are several well documented bugs in how DROSS and Windoze systems
invoke Perl programs . . .

> ....is there any
> configuration file I can edit so perl will automatically understand it to

be
> run with a -T option? I want to run the script with a Perl IDE that I've
> downloaded and it gives me this error unless I take out the -T option. Do

I
> have to take out the -T evertime I run the script with the IDE or is there
> something I can do?


I assume Windoze.

From the ActivePerl user guide, look at
file://E:\Perl\html\faq\Windows\ActivePerl-Winfaq4.html#What_s_the_equivalent_of_the_she
(for E:, substitute the drive you have installed ActivePerl on):
<QUOTE>Unfortunately, Win32 platforms don't provide the shebang syntax, or
anything like it. You can try one of the two following methods to run a
script from the command line. If all else fails, you can always just call
the perl interpreter directly, as in perl myscript.pl.

.. . .

For Windows NT 4.0/2000, the coolest method is to use associated file types
(see How do I associate Perl scripts with perl?). If you've associated Perl
scripts with the .pl extension, you can just type the name of your file at
the command line and Windows NT/2000 will launch perl.exe for you.

</QUOTE>

I guess you could hard-wire "-T" into the Perl command line associated with
extension ".pl", but that would impose taint checking everywhere, which
would give you headaches.



If you change the PATHEXT environment variable to include .pl files, like
this:

SET PATHEXT=.pl;%PATHEXT%
you can just type the file name without an extension, and Windows NT/2000
will find the first .pl file in your path with that name. You may want to
set PATHEXT in the System control panel rather than on the command line.
Otherwise, you'll have to re-enter it each time the command prompt window
closes.

<QUOTE> Note that the file association method does not work for Windows 9x,
nor does it work with Windows NT/2000 if you have command extensions
disabled. You can, however, still start the Perl script from an Explorer
window if the extension is associated with perl.

Another option is to use the pl2bat utility distributed with ActivePerl to
convert your Perl script into a batch file. What this does is tag some Win32
batch language to the front of your script so that the system calls the perl
interpreter on the file. It's quite a clever piece of batch coding,
actually.

If you call the pl2bat utility on your Perl script helloworld.pl, like this:

C:\> pl2bat helloworld.pl
it will produce a batch file, helloworld.bat. You can then invoke the script
just like this:

C:\> helloworld
Hello, World!
You can pass command line parameters, as well. Your script can be in your
PATH, or in another directory, and the pl2bat code will usually find it and
execute it correctly. The big advantage of this over file associations is
that I/O redirection will work correctly.

pl2bat has a number of useful command line options to affect how the
wrapping is done, what command line switches to pass to perl, etc. Running
perldoc pl2bat at the command line will show a full description of these
options.

</QUOTE>

When I run this little script, called "trial_shebang.pl":
#!e:\perl\bin\perl.exe -wT

use strict;
print "Howdy do there\n"

I see what you saw:
D:\Clyde\perldev\Trial>trial_shebang.pl
Too late for "-T" option at D:\Clyde\perldev\Trial\trial_shebang.pl
line 1.

When I run:
D:\Clyde\perldev\Trial>pl2bat trial_shebang.pl

pl2bat creates a DROSS batch file "trial_shebang.bat"
When I run it, I see this:

D:\Clyde\perldev\Trial>trial_shebang
Howdy do there

Now, whether this is any help to you depends on how your IDE invokes your
Perl programs.
Which IDE was it?
..
Regards,
Clyde





 
Reply With Quote
 
 
 
 
Tassilo v. Parseval
Guest
Posts: n/a
 
      04-20-2004
Also sprach Robin:

> I am running active perl 8.2.3 Build 809 and I'm wondering why when I turn
> on taint mode checking on the #!/usr/bin/perl line whenver I run the script
> it gives me an error "Too late for -T option at bbs.pl line 1." and whenever
> I run the script with perl -T bbs.pl it works fine....is there any
> configuration file I can edit so perl will automatically understand it to be
> run with a -T option? I want to run the script with a Perl IDE that I've
> downloaded and it gives me this error unless I take out the -T option. Do I
> have to take out the -T evertime I run the script with the IDE or is there
> something I can do?


The reason why this happens is that your operating system (most probably
Windows) doesn't take the shebang line into account. However, perl does.
It executes the script and looks at the shebang line to see whether it
should include some switches (like -w). This doesn't work with the -T
switch because a perl instance cannot switch to tainted mode. It has to
know right from the start that it should use taintedness.

You can probably tell your IDE to use 'perl -T' instead of 'perl' as the
interpreter.

Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus}) !JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexi ixesixeseg;y~\n~~dddd;eval
 
Reply With Quote
 
Robin
Guest
Posts: n/a
 
      04-20-2004
> "Robin" <robin @ infusedlight.net> wrote in message
> news:c62hsr$qci$(E-Mail Removed)...
> > I am running active perl 8.2.3 Build 809 and I'm wondering why when I

turn
> > on taint mode checking on the #!/usr/bin/perl line whenver I run the

> script
> > it gives me an error "Too late for -T option at bbs.pl line 1." and

> whenever
> > I run the script with perl -T bbs.pl it works fine

>
> You have not said which platform you are running on.
> What you hint at should behave correctly on most UNIX systems.
> There are several well documented bugs in how DROSS and Windoze systems
> invoke Perl programs . . .


> > ....is there any
> > configuration file I can edit so perl will automatically understand it

to
> be
> > run with a -T option? I want to run the script with a Perl IDE that I've
> > downloaded and it gives me this error unless I take out the -T option.

Do
> I
> > have to take out the -T evertime I run the script with the IDE or is

there
> > something I can do?



>
> I guess you could hard-wire "-T" into the Perl command line associated

with
> extension ".pl", but that would impose taint checking everywhere, which
> would give you headaches.


I was thinking the exact same thing...thanks.

> If you change the PATHEXT environment variable to include .pl files, like
> this:
>
> SET PATHEXT=.pl;%PATHEXT%
> you can just type the file name without an extension, and Windows NT/2000
> will find the first .pl file in your path with that name. You may want to
> set PATHEXT in the System control panel rather than on the command line.
> Otherwise, you'll have to re-enter it each time the command prompt window
> closes.


Thanks... this is probably what I'll do. I mainly write cgi scripts, so
having -T imposed on all my scripts won't be too bad.

Which IDE was it?

Optiperl. And it doesn't have an option for turning on taint checking.


--
Regards,
-Robin
--
[ webmaster @ infusedlight.net ]



 
Reply With Quote
 
Robin
Guest
Posts: n/a
 
      04-20-2004
Thanks...

> You can probably tell your IDE to use 'perl -T' instead of 'perl' as the
> interpreter.


This is the problem...I can't...but I'll probably do what Clyde suggested.
Thanks.


--
Regards,
-Robin
--
[ webmaster @ infusedlight.net ]


 
Reply With Quote
 
Robin
Guest
Posts: n/a
 
      04-21-2004

"Clyde Ingram"
<(E-Mail Removed) venospamorham.co.uk> wrote
in message news:9o7hc.52$(E-Mail Removed)...
> Robin,
>
> "Robin" <robin @ infusedlight.net> wrote in message
> news:c62hsr$qci$(E-Mail Removed)...
> > I am running active perl 8.2.3 Build 809 and I'm wondering why when I

turn
> > on taint mode checking on the #!/usr/bin/perl line whenver I run the

> script
> > it gives me an error "Too late for -T option at bbs.pl line 1." and

> whenever
> > I run the script with perl -T bbs.pl it works fine

>
> You have not said which platform you are running on.
> What you hint at should behave correctly on most UNIX systems.
> There are several well documented bugs in how DROSS and Windoze systems
> invoke Perl programs . . .
>
> > ....is there any
> > configuration file I can edit so perl will automatically understand it

to
> be
> > run with a -T option? I want to run the script with a Perl IDE that I've
> > downloaded and it gives me this error unless I take out the -T option.

Do
> I
> > have to take out the -T evertime I run the script with the IDE or is

there
> > something I can do?

>
> I assume Windoze.
>
> From the ActivePerl user guide, look at
>

file://E:\Perl\html\faq\Windows\ActivePerl-Winfaq4.html#What_s_the_equivalen
t_of_the_she
> (for E:, substitute the drive you have installed ActivePerl on):
> <QUOTE>Unfortunately, Win32 platforms don't provide the shebang syntax, or
> anything like it. You can try one of the two following methods to run a
> script from the command line. If all else fails, you can always just call
> the perl interpreter directly, as in perl myscript.pl.
>
> . . .
>
> For Windows NT 4.0/2000, the coolest method is to use associated file

types
> (see How do I associate Perl scripts with perl?). If you've associated

Perl
> scripts with the .pl extension, you can just type the name of your file at
> the command line and Windows NT/2000 will launch perl.exe for you.
>
> </QUOTE>
>
> I guess you could hard-wire "-T" into the Perl command line associated

with
> extension ".pl", but that would impose taint checking everywhere, which
> would give you headaches.
>
>
>
> If you change the PATHEXT environment variable to include .pl files, like
> this:
>
> SET PATHEXT=.pl;%PATHEXT%
> you can just type the file name without an extension, and Windows NT/2000
> will find the first .pl file in your path with that name. You may want to
> set PATHEXT in the System control panel rather than on the command line.
> Otherwise, you'll have to re-enter it each time the command prompt window
> closes.
>
> <QUOTE> Note that the file association method does not work for Windows

9x,
> nor does it work with Windows NT/2000 if you have command extensions
> disabled. You can, however, still start the Perl script from an Explorer
> window if the extension is associated with perl.
>
> Another option is to use the pl2bat utility distributed with ActivePerl to
> convert your Perl script into a batch file. What this does is tag some

Win32
> batch language to the front of your script so that the system calls the

perl
> interpreter on the file. It's quite a clever piece of batch coding,
> actually.
>
> If you call the pl2bat utility on your Perl script helloworld.pl, like

this:
>
> C:\> pl2bat helloworld.pl
> it will produce a batch file, helloworld.bat. You can then invoke the

script
> just like this:
>
> C:\> helloworld
> Hello, World!
> You can pass command line parameters, as well. Your script can be in your
> PATH, or in another directory, and the pl2bat code will usually find it

and
> execute it correctly. The big advantage of this over file associations is
> that I/O redirection will work correctly.
>
> pl2bat has a number of useful command line options to affect how the
> wrapping is done, what command line switches to pass to perl, etc. Running
> perldoc pl2bat at the command line will show a full description of these
> options.
>
> </QUOTE>
>
> When I run this little script, called "trial_shebang.pl":
> #!e:\perl\bin\perl.exe -wT
>
> use strict;
> print "Howdy do there\n"
>
> I see what you saw:
> D:\Clyde\perldev\Trial>trial_shebang.pl
> Too late for "-T" option at

D:\Clyde\perldev\Trial\trial_shebang.pl
> line 1.
>
> When I run:
> D:\Clyde\perldev\Trial>pl2bat trial_shebang.pl
>
> pl2bat creates a DROSS batch file "trial_shebang.bat"
> When I run it, I see this:
>
> D:\Clyde\perldev\Trial>trial_shebang
> Howdy do there
>
> Now, whether this is any help to you depends on how your IDE invokes your
> Perl programs.
> Which IDE was it?
> .
> Regards,
> Clyde


Yeah, optiperl still isn't working with this, but it's cool, it's still
running. Check out new scripts at www.infusedlight.net
-Later,
Robin


 
Reply With Quote
 
Robin
Guest
Posts: n/a
 
      04-21-2004

"Tassilo v. Parseval" <(E-Mail Removed)> wrote in message
news:c6304s$7edtm$(E-Mail Removed)-berlin.de...
> Also sprach Robin:
>
> > I am running active perl 8.2.3 Build 809 and I'm wondering why when I

turn
> > on taint mode checking on the #!/usr/bin/perl line whenver I run the

script
> > it gives me an error "Too late for -T option at bbs.pl line 1." and

whenever
> > I run the script with perl -T bbs.pl it works fine....is there any
> > configuration file I can edit so perl will automatically understand it

to be
> > run with a -T option? I want to run the script with a Perl IDE that I've
> > downloaded and it gives me this error unless I take out the -T option.

Do I
> > have to take out the -T evertime I run the script with the IDE or is

there
> > something I can do?

>
> The reason why this happens is that your operating system (most probably
> Windows) doesn't take the shebang line into account. However, perl does.
> It executes the script and looks at the shebang line to see whether it
> should include some switches (like -w). This doesn't work with the -T
> switch because a perl instance cannot switch to tainted mode. It has to
> know right from the start that it should use taintedness.
>
> You can probably tell your IDE to use 'perl -T' instead of 'perl' as the
> interpreter.
>
> Tassilo
> --
>

$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
>

pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus}) !JAPH!qq(rehtona{tsuJbus#;
>

$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexi ixesixeseg;y~\n~~dddd;eval

So Perl's not that smart... I'm so burned out on perl, what's perl.

-Robin


 
Reply With Quote
 
Tassilo v. Parseval
Guest
Posts: n/a
 
      04-21-2004
Also sprach Robin:

> So Perl's not that smart... I'm so burned out on perl, what's perl.


perl is the thing which runs programs written in Perl. See

What's the difference between "perl" and "Perl"?

in perlfaq1.

Other than that, the tainting-happening-too-late issue is none of the
language. It's about the interpreter being not smart enough to do it.
However, tainted mode hooks very deeply into the interpreter and it is
not trivial to switch from untainted to tainted mode at runtime. It may
look trivial to you but taintedness has some serious implications for
the whole interpreter in nearly all aspects.

That's why the interpreter has to be told about it right at the start.

Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus}) !JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexi ixesixeseg;y~\n~~dddd;eval
 
Reply With Quote
 
Joe Smith
Guest
Posts: n/a
 
      04-21-2004
Robin wrote:

> "Clyde Ingram"
> ... [over 100 lines deleted]
> Yeah, optiperl still isn't working with this, but it's cool, it's still
> running. Check out new scripts at www.infusedlight.net


Don't quote the entire article just to add two lines of commentary.
-Joe
 
Reply With Quote
 
Brian Helterline
Guest
Posts: n/a
 
      04-22-2004

"Robin" <robin @ infusedlight.net> wrote in message
news:c63mu9$6fe$(E-Mail Removed)...
> > "Robin" <robin @ infusedlight.net> wrote in message
> > news:c62hsr$qci$(E-Mail Removed)...
> > > I am running active perl 8.2.3 Build 809 and I'm wondering why when I

> turn
> > > on taint mode checking on the #!/usr/bin/perl line whenver I run the

> > script
> > > it gives me an error "Too late for -T option at bbs.pl line 1." and

> > whenever
> > > I run the script with perl -T bbs.pl it works fine

> >
> > You have not said which platform you are running on.
> > What you hint at should behave correctly on most UNIX systems.
> > There are several well documented bugs in how DROSS and Windoze systems
> > invoke Perl programs . . .

>
> > > ....is there any
> > > configuration file I can edit so perl will automatically understand it

> to
> > be
> > > run with a -T option? I want to run the script with a Perl IDE that

I've
> > > downloaded and it gives me this error unless I take out the -T option.

> Do
> > I
> > > have to take out the -T evertime I run the script with the IDE or is

> there
> > > something I can do?

>
>
> >
> > I guess you could hard-wire "-T" into the Perl command line associated

> with
> > extension ".pl", but that would impose taint checking everywhere, which
> > would give you headaches.

>
> I was thinking the exact same thing...thanks.
>

Another solution is to have your CGI scripts end with .cgi rather than .pl
and then create the association of .cgi to perl with -T enabled. This
forces all cgi scripts to be run with -T while normal perl scripts (.pl) are
not.

--
brian


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Upgrading from 32 bit ActivePerl-5.8.8.817 to 64 bit ActivePerl-5.8.8.819 Ted Perl Misc 7 12-16-2006 03:45 AM
DHCP relay agent versus Option 3; Routers Option lcorrigan Cisco 2 09-27-2006 05:18 PM
no 'option' in aspx file means 'option'="false"? Cas ASP .Net 5 08-28-2006 10:36 AM
ActivePerl and -P option Viviana Vc Perl Misc 6 06-08-2005 08:06 AM
g++ -pg option and -shared option Julien ROUZIERES C++ 1 12-21-2004 02:30 PM



Advertisments