Grokbase
Topics Posts Groups | in
x
[ help ]

Too late for -Co

View TopicPrint | Flat  Thread  Threaded
1) Alberto Simões Hi, Folks. I had some CGI scripts using #!perl -CoO Now, with perl 5.10.0 I can't do that. What is...
| +1 vote (Anchor)
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Hi, Folks.

I had some CGI scripts using
#!perl -CoO

Now, with perl 5.10.0 I can't do that.

What is the preferred solution?

Thank you.
ambs
--
Alberto Simões - Departamento de Informática - Universidade do Minho
Campus de Gualtar - 4710-057 Braga - Portugal
2) Nicholas Clark IIRC it didn't ever actually work on 5.8.x. (If so) if you take it out, does anything change?...
| +1 vote (Anchor)
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
On Tue, Mar 25, 2008 at 09:33:28PM +0000, Alberto Simes wrote:
> Hi, Folks.
>
> I had some CGI scripts using
> #!perl -CoO
>
> Now, with perl 5.10.0 I can't do that.
>
> What is the preferred solution?

IIRC it didn't ever actually work on 5.8.x. (If so) if you take it out, does
anything change?

(What might be more accurate is that it doesn't work at the time of the perl
interpreter's #! line processing, but if the invoking program is the shell, and
processes that first line itself, to add options to the C argv passed to the
perl interpreter, then *that* would be setting them.

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

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)

Nicholas Clark
3) Alberto Simões using binmode STDOUT, ":utf8" Thanks > ambs...
| +1 vote (Anchor)
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Alberto Simões wrote:
> Hi, Folks.
>
> I had some CGI scripts using
> #!perl -CoO
>
> Now, with perl 5.10.0 I can't do that.
>
> What is the preferred solution?

using binmode STDOUT, ":utf8"

Thanks

>
> Thank you.
> ambs

--
Alberto Simões - Departamento de Informática - Universidade do Minho
Campus de Gualtar - 4710-057 Braga - Portugal
4) Alberto Simões It worked with 5.8.8 ...
| +1 vote (Anchor)
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Nicholas Clark wrote:
> On Tue, Mar 25, 2008 at 09:33:28PM +0000, Alberto Simes wrote:
>> Hi, Folks.
>>
>> I had some CGI scripts using
>> #!perl -CoO
>>
>> Now, with perl 5.10.0 I can't do that.
>>
>> What is the preferred solution?
>
> IIRC it didn't ever actually work on 5.8.x. (If so) if you take it out, does
> anything change?

It worked with 5.8.8

:)
--
Alberto Simões - Departamento de Informática - Universidade do Minho
Campus de Gualtar - 4710-057 Braga - Portugal
5) A. Pagaltzis use open OUT => ':utf8', ':std'; Regards,
| +1 vote (Anchor)
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
* Alberto Simões <albie@alfarrabio.di.uminho.pt> [2008-03-25 22:35]:
> I had some CGI scripts using
> #!perl -CoO
>
> Now, with perl 5.10.0 I can't do that.
>
> What is the preferred solution?

    use open OUT => ':utf8', ':std';

Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>
6) A. Pagaltzis Hi Nicholas, no, it’s the kernel that does that, automatically. The shell has nothing to do with...
| +1 vote (Anchor)
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
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/>
spacer
View TopicPrint | Flat  Thread  Threaded
Home > Groups > Perl 5 Porters > Too late for -Co (6 posts)