develooper Front page | perl.perl5.porters | Postings from March 2008

Re: Too late for -Co

Thread Previous | Thread Next
From:
Aristotle Pagaltzis
Date:
March 25, 2008 20:34
Subject:
Re: Too late for -Co
Message ID:
20080326033428.GM22144@klangraum
Hi Nicholas,

* Nicholas Clark <nick@ccl4.org> [2008-03-25 23:00]:
> Someone else correct me if I'm wrong, but as I understand it,
> if you start your script ./rakkk
> 
> #!/usr/bin/perl -w
> 
> then often perl is invoked by the shell as
> 
> /usr/bin/perl -w ./rakkk

no, it’s the kernel that does that, automatically. The shell has
nothing to do with it.

The reason perl parses the switches again is that it might be
invoked in some other fashion than implicitly via the shebang
under a Unixoid kernel; eg. the user types `perl ./rakk` into
the shell. In such a case, the shebang line options would fail
to have an effect if perl didn’t parse them.

> and that -w is set and processed before the script is opened.
> But then perl reads in the first line of the script, and
> processes the -w again (using Perl_moreswitches()). But for all
> the command line options that can be used on the #! line, it
> doesn't matter if they are processed multiple times)

Yeah, that’s why you can’t use -M on the shebang line. It’s also
obvious why you can’t use -T, even though that’s for a different
reason. It’s not so obvious why 5.10 has promoted -C to this
club, though.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About