[19650] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1845 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 30 11:06:48 2001

Date: Sun, 30 Sep 2001 08:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1001862308-v10-i1845@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 30 Sep 2001     Volume: 10 Number: 1845

Today's topics:
        anybody using PerlComposer? <allan.miller@sarvasiddhi.freeuk.com>
        Getting a perl CGI script to write to a file on another <simonp@NOSPAM.dircon.co.uk>
    Re: Getting a perl CGI script to write to a file on ano <jurgenex@hotmail.com>
        HELP: /stuff(\d+)|oth(\d+)/;$num=$1 doesn't work? (Bruno Boettcher)
    Re: IO::Socket && IO::Select Problem <goldbb2@earthlink.net>
    Re: IO::Socket && IO::Select Problem <goldbb2@earthlink.net>
    Re: Limitation (Ragnar Hojland Espinosa)
    Re: newbie question <krahnj@acm.org>
        Passing arguments to subs <scott.bell1@ntlworld.com>
    Re: Sorting multidimensional arrays and MIN/MAX <bigusAT@btinternetDOT.com>
    Re: Strange results... <weiss@kung.foo.at>
        unmatched expression <seajay@teckies.com>
    Re: unmatched expression <davidhilseenews@yahoo.com>
    Re: unmatched expression <bigusAT@btinternetDOT.com>
        Win/UNIX Perl CGI incompatibility <philip@zaynar.demon.co.uk>
    Re: Win/UNIX Perl CGI incompatibility <ilya@martynov.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 30 Sep 2001 14:39:19 +0100
From: "allan.miller" <allan.miller@sarvasiddhi.freeuk.com>
Subject: anybody using PerlComposer?
Message-Id: <1001856906.38713.1@eurus.uk.clara.net>

Is anybody using PerlComposer?

I have downloaded it from sourceforge but have not got it running yet. I
am wondering whether it is worth persuing.

TIA

Allan Miller


------------------------------

Date: Sun, 30 Sep 2001 14:12:47 +0100
From: "Simon Pearce" <simonp@NOSPAM.dircon.co.uk>
Subject: Getting a perl CGI script to write to a file on another server
Message-Id: <9p75q3$rmf$1@news7.svr.pol.co.uk>

Humm - this should be good

I have an online booking system that takes details, sends confirmation by
e-mail then write stuff to a file.

Now, this all happens on a secure server that i rent space from but I need
the script to write the stuff to a file that exists on a different server -
how can I do this?? I'm using:

$basedir = "/home/x/p/xperience/public_html/cgi-bin/booking";
open(NEWFILE,">$basedir/$orderdir/$num\.txt") || die $!;
etc etc

which works great on the main server - but when I run it from the secure
server - zip.

I've tried chaning $basedir to all sorts but no luck! Help!!

Thanks

Simon




------------------------------

Date: Sun, 30 Sep 2001 07:14:24 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Getting a perl CGI script to write to a file on another server
Message-Id: <3bb728c3$1@news.microsoft.com>

"Simon Pearce" <simonp@NOSPAM.dircon.co.uk> wrote in message
news:9p75q3$rmf$1@news7.svr.pol.co.uk...
> Humm - this should be good
>
> I have an online booking system that takes details, sends confirmation by
> e-mail then write stuff to a file.
>
> Now, this all happens on a secure server that i rent space from but I need
> the script to write the stuff to a file that exists on a different
server -
> how can I do this?? I'm using:
>
> $basedir = "/home/x/p/xperience/public_html/cgi-bin/booking";
> open(NEWFILE,">$basedir/$orderdir/$num\.txt") || die $!;
> etc etc
>
> which works great on the main server - but when I run it from the secure
> server - zip.
>
> I've tried chaning $basedir to all sorts but no luck! Help!!

Actually your question has nothing to do with CGI. Let me translate your
question:
How can a Perl script running on computer A (it doesn't matter if this is a
CGI server, a secure server, or whatever) copy/write a file to/on computer
B.

Well, you need to find out which services B offers to the world (or at least
to computer A). Maybe FTP, or a remote copy, or NFS, or ....
If B offers nothing but HTTP then you could run a CGI download script on B
and automatically call it from A via the Perl LWP module.

jue




------------------------------

Date: Sun, 30 Sep 2001 10:19:54 +0000 (UTC)
From: bboett@bboett.dyndns.org (Bruno Boettcher)
Subject: HELP: /stuff(\d+)|oth(\d+)/;$num=$1 doesn't work?
Message-Id: <9p6rka$lp2$1@neon.noos.net>

hello, i am modifying a script, and have the following scema:
$pattern = "stuff(\d+)";
$pattern .= "|oth(\d+)";
 ... (a whole list...)
and then i try:
$line =~ /$pattern/;
$num=$1;

thinking naively that the submatch would be stored as usual in the $1-$N
vars... but alas the var is empty... so where my error, and what would
be the best to perform the above mentioned task? (its kinda speed
critical, thus i didn't use a while loop and a stack for the pattern,
feeled much slower..)

thanks for any help!
-- 
ciao bboett
==============================================================
bboett@earthling.net
http://inforezo.u-strasbg.fr/~bboett http://erm1.u-strasbg.fr/~bboett


------------------------------

Date: Sun, 30 Sep 2001 00:14:37 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: IO::Socket && IO::Select Problem
Message-Id: <3BB69C2C.16538D62@earthlink.net>

Tristan Braun wrote:
> 
> "Bart Lateur" <bart.lateur@skynet.be> schrieb im Newsbeitrag
> news:ekv9rtg67sbfhromlj441bphqj504b05hf@4ax.com...
> 
> Hi !
> 
> > The four argument select(), a perl primitive, uses strings as bit
> > masks to check out what handles to monitor. Thus, again, Perl is not
> > the limiting factor here. IO::Select is just a fancier interface on
> > top of this primitive.
> >
> > I think the limitation is with your OS, which somehow forbids your
> > script to have too many handles open at the same time.
> 
> I count the incoming connections and if there where more than 100
> I stored them (100+) in a new IO::Select bag to test if my script can
> accept more then 128 connections.
> 
> And it does ! So accepting [IO::Socket] is not the problem - its
> IO::Select.

Or rather, the underlying select() is limited, though I suppose this
distinction isn't important.

> So the only workaround would be to create for every X connections a
> seperate IO::Select bag. But I tried several way to get the blocking
> routine work rigth. Like ...
> 
> while (@ready_ones = ($Select[1]->can_read || $Select[2]->can_read))
> { ... }
> 
> Any ideas ?

Assuming all you IO::Select objects are in @Select ...

while( @Select ) {
	my @ready;
	$! = 0;
	push @ready, $_->can_read(0) for @Select;
	die "select: $!" if $!;
	$Select[0]->can_read(0.2), next if !@ready;
	....
}

This will essentially repeatedly poll all of the Select objects, pausing
0.2 seconds between each try.  [The can_read(0.2) does a very quick test
on the first one in the array, with a short timeout... but this acts
about like sleep(0.2) [except that sleep() only accepts integers]]

Try and always keep the first select objects in the list full of as many
as you can query at once [ie, don't have any partially full select
objects in the array except the last]

-- 
"I think not," said Descartes, and promptly disappeared.


------------------------------

Date: Sun, 30 Sep 2001 01:32:14 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: IO::Socket && IO::Select Problem
Message-Id: <3BB6AE5E.AA1B7EC9@earthlink.net>

NuArb wrote:
> 
> Hi all socket-developers,
> 
> I tried to write a chat application. My client is a Java Applet and
> the server is written in PERL.
> 
> The server is listening via IO::Socket on Port 2666. The server is
> blocking until someone has something to say or a new connection
> request. New requests will be accepted and added to IO::Select.
> 
> The client tries to connect to the server and is starting a thread for
> listening on the socket.
> 
[snip]
> I instanciated the page 30 times and the last instance could send a
> message. The same with 60.
> 
> When I try 90 simultanious connections the connect sucedded for all.
> ALL can receive messages. BUT only the first ~60 Instances can send
> and the server receives the message.

I assume [hope] that when you say "and the server receives the message",
you know this via having the server print out it's messages to the
console... otherwise, it's possibly a problem with java being limited.

And for that matter, are you sure it's the server recieving the data, or
just thinking the socket is not readable when it actually is?

> After closing any Instances the previously sended message will
> received by the server.

Very strange behavior.

> The same result is when I startet the VB MDI on two NT boxes with each
> have 50 instances.
> 
> And when try more than 127 connections + 1 listen my perlserver
> crashes.

That *sounds* like you've got a system limit on the number of open
connections.  What kind of error does perl output to the console when it
crashes?

> But in the worst case I will have ~800 users connecting to it !

Might I suggest that you run a number of servers on your machine to
spread the load?

Also... I see a number of improvements that could be made in the code
you have.

#!/usr/local/bin/perl -w
use strict; # always use -w and strict
use IO::Socket;
# don't need to use IO::Socket::INET,
# since it IO::Socket makes it available.
use IO::Select;

# no need to make the log object-oriented.
$SIG{INT} = sub { close CHATLOG; exit 0 };

my $listen = IO::Socket::INET->new(
    # no need for Proto=>'tcp', as that's the default.
    LocalPort => 2666, Listen => 256, Reuse => 1
) or die "Couldn't create listening socket: $!";

my ($reading, $writing) = (IO::Select->new($listen), IO::Select->new);

open( CHATLOG, ">>Chat.txt" )
    or die "Could not open Chat.txt for append: $!";
select( (select(CHATLOG), $|=1)[0] );

my %clients; # data on each client.
my @lines; # last 6 lines

sub debug {
    my ($client, $line) = @_;
    print $line, "\n";
    print CHATLOG "$client->{ip}\[$client->{fileno}]: $line\n"
}

while(1) {
    # yes, I know I discard the list of writables... see below.
    my ($toread) = IO::Select->select($reading, $writing);
    my $anoutput = 0;
    foreach my $socket ( @$toread ) {
        if( $socket == $listen ) {
            my $newsock = $listen->accept;
            $reading->add($newsock);
            $writing->add($newsock);
            $clients{$newsock} = {
                ip => join(".", unpack "C4", $newsock->peeraddr),
                output => "0" x 9 . "Willkommen\n" . join("", @lines),
                colors => substr( rand, -9 ),
                fileno => $socket->fileno,
            };
            next;
        }
        my $client = $clients{$socket};
        local *buffer = \$client{input};
        $! = 0;
        unless( sysread $socket, $buffer, 4096, length $buffer ) {
            debug( $client, $! || "sent EOF" );
            close $socket;
            $reading->remove($socket);
            $writing->remove($socket);
            delete $clients{$socket};
            next;
        }
        while((my $newline = index( $buffer, "\n" )) >= 0) {
            my $theline = substr( $buffer, 0, $newline, "" );
            $theline =~ tr/\012\015//d;
            debug( $client, $theline );
            $theline = $client{colors} . $theline . "\n";
            push @lines, $theline; shift @lines if @lines > 6;
            $_->{output} .= $theline for values %clients;
            $anoutput = 1;
        }
    }
    $writing->add(grep $_ != $listen, $reading->handles) if $anoutput;
    # I query writability with a 0 timeout.  Most sockets are
    # always writable... most of the time.  However, it's best not to
    # take chances, so I buffer output.  Actually, since it's possible
    # that more than 1 socket will have data within the same pass
    # through the outermost loop, this is a good thing anyway.
    foreach my $socket ( $writing->can_read(0) ) {
        my $client = $clients{$socket};
        local *buffer = \$client{output};
        my $wrote = syswrite( $socket, $buffer ) or do {
            debug($client, "failed to write: $!");
            close $socket;
            $reading->remove($socket);
            $writing->remove($socket);
            delete $clients{$socket};
            next;
        };
        substr( $buffer, 0, $wrote, "" );
        $writing->remove($socket) if !length $buffer;
    }
}

Among other things... using "send" is a bad idea, unless you're dealing
with a udp socket.  Don't use it for tcp... it might work, or it might
not.  Likewise with recv.

-- 
"I think not," said Descartes, and promptly disappeared.


------------------------------

Date: 30 Sep 2001 05:16:58 -0700
From: ragnar_hojland@eresmas.com (Ragnar Hojland Espinosa)
Subject: Re: Limitation
Message-Id: <244a4f2d.0109300416.97fa294@posting.google.com>

* Tong * <sun_tong@users.sourceforge.net> wrote in message news:<sa8n13d4m67.fsf_-_@suntong.personal.users.sourceforge.net>...
> gazelle@yin.interaccess.com (Kenny McCormack) writes:
> 
> > >With a PC, I always felt limited by the software available.
> > >On Unix, I am limited only by my knowledge.
> > 
> > But, of course, the real question is, what does this quote actually mean?
> > Since it was posted in a Unix group, we tend to assume it is the typical
> > "Unix good - Windoze bad" sort of thing, but OTOH, being attributed to
> > Leader Bill, one ought to assume the contrary.  And, in fact, it could

Actually, if you imply PC==MS Windows, the simplest explanation is
that under MS Windows almost everything is done by the GUI, which
means its hard to do things the UI designers didn't think of. 
Traditionally Unix has followed the 1 tool for 1 task philosophy,
which is much more apropiate in terms of flexibitily, therefore not
constraining the user to a wrap-it-all GUI.  In other words 1 (tool) +
1 is ~2 under MS Windows, and +2 under Unix.

> I was hindered by the saying "Look how many application written for
> Windows, and how many for Linux", before I enter the Linux world.
> I'm not saying it is wrong, it is still true by now. But the

MS has an dvantage here, and that is backwards compatibilty.  They are
very good at that.  And they have a more or less consistent GUI
component model.. if you have a look at where Unix has been.. quite
distressing.

> difference is I know "why" now. Offline browser, for example, *nix
> has only one official tool -- wget, "quite pathetic" you might

You may want to try wwwoffle instead.  wget is more a downloader..

> Another example, if you have a rather large collection of MP3 files,
> getting from different sources, spreading over several directories
[...]
> Windoze people, unfortunately, have to wait for such kind of
> commercial tools, then happily spend their money on them.

Or they could get perl and do the same (heh, jusnt noticed the
crossposting:)  Unless they want an unnecessary flashy GUI to avoid
reading the 2k readme.  Most will wait.  And MS knows that.

Ragnar Højland      Freedom - Linux - OpenGL |    Brainbench MVP
PGP94C4B2F0D27DE025BE2302C104B78C56 B72F0822 | for Unix Programming
"Thou shalt not follow the NULL pointer for  |  www.brainbench.com
 chaos and madness await thee at its end."


------------------------------

Date: Sun, 30 Sep 2001 05:18:21 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: newbie question
Message-Id: <3BB6AB9D.EF641C37@acm.org>

bal wrote:
> 
> Hi
> I have the following program:
> 
> #!/usr/bin/perl -w
> $file = 'a.txt';
> open(INFO, $file);
> $qw=1;
> while ($l = <INFO>) {
>  print $qw." "."$l";
>  $qw=$qw+1;
>  }
> close(INFO);
> 
> How can I alter it so that line numbers are printed as 001, 002, ...,
> 009, 010, 011, 012, etc as opposed to 1,2,3,etc


#!/usr/bin/perl -w
use strict;

my $file = 'a.txt';
open INFO, $file or die "Cannot open $file: $!";
while ( <INFO> ) {
    printf '%03d %s', $., $_;
    }
close INFO;





John
-- 
use Perl;
program
fulfillment


------------------------------

Date: Sun, 30 Sep 2001 15:52:37 +0100
From: "Scott Bell" <scott.bell1@ntlworld.com>
Subject: Passing arguments to subs
Message-Id: <ziGt7.2968$qi.455117@news2-win.server.ntlworld.com>

I'm making a webpage in cgi, it's devided into sections. To go to the
pictures section you could follow a link to ?content=pictures, if you wanted
to go to the help section you would follow a link to ?content=help, this
works fine but I want to put all the code that outputs html code in a
seperate procedure, but how do I tell this procedure what page to display, I
can't make it figure out from $query->param(content) because I might want to
jump to a page they havn't linked to. I know I could do something like

$content = "pictures";
&showpage;

then depend on the $content variable, but is this the correct way to do it?
could I do something like

&showpage "pictures";


thanks

--
Scott




------------------------------

Date: Sun, 30 Sep 2001 11:16:36 +0100
From: "S Warhurst" <bigusAT@btinternetDOT.com>
Subject: Re: Sorting multidimensional arrays and MIN/MAX
Message-Id: <9p6rbh$evj$1@uranium.btinternet.com>

"Steffen Müller" <tsee@gmx.net> wrote in message
news:9p5359$pqh$04$1@news.t-online.com...

Well, I did have a surf for the answer but could only find info about
sorting hashes & standard 1-D arrays etc.. but given my knowledge level of
Perl it may have been on one of those pages but just didn't word it as "here
is how to sort multidimensional arrays, bozo" ;)

> @array = sort { $a->[1] <=> $b->[1] } @array;
> #                    ^           ^
> #                   second element!

That works very nicely :)  I wish I understood HOW it works, but I guess one
can't have everything ;-)

> my ( $min, $max ) = ( $array[0][1] );
> foreach ( @array ) {
>    $min = $_[1] if $_[1] < $min;
>    $max = $_[1] if $_[1] > $max;
> }

I haven't tested this yet but that looks to be a more concise way of doing
it than what I would have written.

Thanks v.much for your help :-)

Bigus/S. Warhurst




------------------------------

Date: Sun, 30 Sep 2001 14:15:58 +0200
From: "Stefan Weiss" <weiss@kung.foo.at>
Subject: Re: Strange results...
Message-Id: <1001852427.286840@newsmaster-04.atnet.at>

"Leopold Toetsch" <lt@toetsch.at> wrote:

> > While I was playing around with your sig, I accidentally cut&pasted
> > pasted a piece of code to the wrong place,
>
> The sig is of course not belonging to the program. (It gets appended
> automatically and chosen from a random pool of sayings from Adventure)

Right, I was referring to the JAPH you posted.

Anyone care too look at the results I was getting with the script from
my last posting? I don't want to shout 'bug!', but... it seems strange
that the output contains all these environment settings etc.

cheers,
stefan





------------------------------

Date: Sun, 30 Sep 2001 08:49:04 +0300
From: "seajay" <seajay@teckies.com>
Subject: unmatched expression
Message-Id: <trdds0qhvp4t2c@corp.supernews.com>

hi,

I am writing a program that would match user agents inside
a log file, for e.g I want to match "Mozilla/4.0 (compatible; MSIE 4.01; =
Windows 98)"
inside $str using REGEX

Here's the script I wrote, strangely it won't match $var inside $str, I =
suppose
this might had to do something with the / ; () inside my $var
how can I resolve this problem=20

thanks
seajay



#!/perl/bin/perl -w

use strict;

my %hash;
my $str =3D 'rll%127.0.0.1|Mozilla/4.0 (compatible; MSIE 4.01; Windows =
98)|http://localhost/servban/';



$hash{'AGENT'} =3D 'Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)';


my $var =3D $hash{'AGENT'};


 if ($str =3D~ m/$var/)
 {
 print "MATCH";
 }

 else {
 print "NO";
 }







------------------------------

Date: Sun, 30 Sep 2001 07:33:21 GMT
From: "David Hilsee" <davidhilseenews@yahoo.com>
Subject: Re: unmatched expression
Message-Id: <5Vzt7.17722$Xz1.4016279@news1.rdc1.md.home.com>


"seajay" <seajay@teckies.com> wrote in message
news:trdds0qhvp4t2c@corp.supernews.com...
hi,

I am writing a program that would match user agents inside
a log file, for e.g I want to match "Mozilla/4.0 (compatible; MSIE 4.01;
Windows 98)"
inside $str using REGEX

Here's the script I wrote, strangely it won't match $var inside $str, I
suppose
this might had to do something with the / ; () inside my $var
how can I resolve this problem

thanks
seajay

#!/perl/bin/perl -w

use strict;

my %hash;
my $str = 'rll%127.0.0.1|Mozilla/4.0 (compatible; MSIE 4.01; Windows
98)|http://localhost/servban/';

$hash{'AGENT'} = 'Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)';

my $var = $hash{'AGENT'};

 if ($str =~ m/$var/)
 {
 print "MATCH";
 }

 else {
 print "NO";
 }

<end OP>

perldoc -f quotemeta
$escapedvar = quotemeta $var;
 ...m/$escapedvar/...

--
David Hilsee






------------------------------

Date: Sun, 30 Sep 2001 10:56:19 +0100
From: "S Warhurst" <bigusAT@btinternetDOT.com>
Subject: Re: unmatched expression
Message-Id: <9p6q5c$k2v$1@neptunium.btinternet.com>

I'm no Perl expert and there's many things I don't quite understand about
regexps, but in this case, if you escape the parenthesis in your hash, ie:

  $hash{'AGENT'} = 'Mozilla/4.0 \(compatible; MSIE 4.01; Windows 98\)';

you'll find it works.

Generally, and any more knowledgable person correct me if I'm wrong, when
using regexp the string you are searching for should always have all regexp
metacharacters escaped.

¦                 ¦--¦
¦--¦- Bigus -¦--¦
¦--¦


"seajay" <seajay@teckies.com> wrote in message
news:trdds0qhvp4t2c@corp.supernews.com...
hi,

I am writing a program that would match user agents inside
a log file, for e.g I want to match "Mozilla/4.0 (compatible; MSIE 4.01;
Windows 98)"
inside $str using REGEX

Here's the script I wrote, strangely it won't match $var inside $str, I
suppose
this might had to do something with the / ; () inside my $var
how can I resolve this problem

thanks
seajay



#!/perl/bin/perl -w

use strict;

my %hash;
my $str = 'rll%127.0.0.1|Mozilla/4.0 (compatible; MSIE 4.01; Windows
98)|http://localhost/servban/';



$hash{'AGENT'} = 'Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)';


my $var = $hash{'AGENT'};


 if ($str =~ m/$var/)
 {
 print "MATCH";
 }

 else {
 print "NO";
 }









------------------------------

Date: Sun, 30 Sep 2001 09:13:46 +0100
From: Philip Taylor <philip@zaynar.demon.co.uk>
Subject: Win/UNIX Perl CGI incompatibility
Message-Id: <iPHm5BA6Qtt7Ewoz@zaynar.demon.co.uk>

I'm writing some Perl CGI programs to run on a Linux Apache web server,
but am testing them offline with OmniHTTPD on Windows (and ActivePerl
5.6.1 build 628). The problem is that scripts such as
  #!/usr/bin/perl -wT
  use strict;
  exit;
work fine on Linux, but on Windows perl complains "Too late for "-T"
option at something.cgi line 1."

This also happens when I run the script directly from the command line
("perl something.cgi"), although it works if I specify -T when running
perl ("perl -T something.cgi").

The web server which I'm using (and which I chose based on the fact that
I didn't care about features and it was fairly small) isn't able to run
perl with the necessary extra options, so I've had to create a .bat file
which executes perl with the correct parameters. But I was wondering if
there's any way to make perl ignore the #! line, yet still allow it to
work fine on Linux -- or should I just get a different Windows web
server?

-- 
Philip Taylor
philip @ zaynar . demon . co . uk

http://robowarriors.ultrastore.com/legoworld.shtml
  -- If the Earth was made of Lego...


------------------------------

Date: 30 Sep 2001 13:19:59 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Win/UNIX Perl CGI incompatibility
Message-Id: <87ofnt3uio.fsf@abra.ru>

>>>>> On Sun, 30 Sep 2001 09:13:46 +0100, Philip Taylor <philip@zaynar.demon.co.uk> said:

PT> I'm writing some Perl CGI programs to run on a Linux Apache web server,
PT> but am testing them offline with OmniHTTPD on Windows (and ActivePerl
PT> 5.6.1 build 628). The problem is that scripts such as
PT>   #!/usr/bin/perl -wT
PT>   use strict;
PT>   exit;
PT> work fine on Linux, but on Windows perl complains "Too late for "-T"
PT> option at something.cgi line 1."

According 'perldoc perldiag':

       Too late for ""-T"" option
           (X) The #! line (or local equivalent) in a Perl script
           contains the -T option, but Perl was not invoked with
           -T in its command line.  This is an error because, by
           the time Perl discovers a -T in a script, it's too
           late to properly taint everything from the environ-
           ment.  So Perl gives up.

What it means? It means that if perl sees -T in its shebang line it
must have -T in its arguments. Win32 platforms itself doesn't support
directly shebang line. So your script is run as

    perl script.pl

causing this error. On Linux shebang is handled directly by OS so your
script is run as

   perl -wT script.pl.

and -T is handled correctly.

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 1845
***************************************


home help back first fref pref prev next nref lref last post