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

Re: another dumpvar panic in RC2

From:
Tom Christiansen
Date:
March 15, 2000 16:10
Subject:
Re: another dumpvar panic in RC2
Message ID:
7720.953165393@chthon
>On Tue, 14 Mar 2000 19:27:51 MST, Tom Christiansen wrote:
>>  DB<1> use POSIX
>>
>>  DB<2> O UsageOnly
>>           UsageOnly = '1'
>>  DB<3> V POSIX
>>Not a GLOB reference at lib/dumpvar.pl line 408, <IN> line 3.

>Looks like dumpvar doesn't know about these funny bits:

>    % perl -lwe 'sub foo; print $main::{foo}'
>    -1
>    % perl -lwe 'sub foo ($@); print $main::{foo}'
>    $@

Is this particularly useful?  It seems fragile.  One mention of
the typeglob without sneaking around Perl's back, and those
properties are gone.

% perl -lwe 'sub foo ($@); print $::{foo}; print *foo; print $::{foo}'  
*main::foo
*main::foo
*main::foo

If you disguise your intent from the compiler, you get by... once.

% perl -lwe 'sub foo; print $main::{foo}; eval q{print *foo}; print $main::{foo}'
-1
*main::foo
*main::foo

% perl -lwe 'sub foo ($@); print $main::{foo}; eval q{print *foo}; print $main::{foo}'
$@
*main::foo
*main::foo

And of course, no difference here:

% perl -lwe 'sub foo ($@); print $::{foo}; eval q{print *foo}; print $::{foo}'
$@
*main::foo
*main::foo

Hm... I wonder whether the compiler could ever look into single-quoted,
compiled-time resolved strings on its eval q{...} stuff to learn more
about what's afoot?

--tom



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