Re: methods and bareword file handles, action at a distance, (un)speed

[email protected] (Nicholas Clark)
Newsgroups perl.perl5.porters
Message-ID <[email protected]>
On Mon, Jun 14, 2010 at 08:57:27AM +0100, Nicholas Clark wrote:

> Which reminded me what Artur said years ago - as well as action at a distance,
> there's a speed hit on every class method call because first the code does a
> stash lookup to see if the package name string is actually a filehandle:
> 
>     http://perl5.git.perl.org/perl.git/blame/086d2913:/pp_hot.c#l3108
> 
> So I wondered. Should we add a flag to pp_method and pp_methodnamed, to allow
> that lookup to be disabled, and add a lexical pragma to enable disabling.
> [And a better way to describe that :-)]

Oh, the fun you can have. This is Debian's stock 5.10

$ cat lax.pm 
fileno strict;
1;
$ perl -le 'use strict; ++$c; print "Ha!"'
Global symbol "$c" requires explicit package name at -e line 1.
Execution of -e aborted due to compilation errors.
$ perl -Mlax -le 'use strict; ++$c; print "Ha!"'
Ha!
$ 

Nicholas Clark
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.