[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Problem with MacPerl 5.06



schinder@pjstoaster.pg.md.us (Paul Schinder) writes:
>test.pl:
>
>#!/usr/local/bin/perl
>package test;
>
>#$a = "test";
>#my $a = "test";
>local $a = "test";
>
>sub test {my $b = $a;return $b};
>1;
>
>testmain.pl:
>
>#!/usr/local/bin/perl
>
>require "test.pl";
>
>$a = test::test();
>print "$test::a, $a\n";
>
>Running testmain with the declaration line in test changed gives the following
>
>             MacPerl 5.06                     Sun Perl 5.001m
>$a:            test, test                        test, test
>local $a:          ,                                 ,
>my $a:             ,                                 , test
>
>
>The latter is what's been the problem with lwp5b6, because the authors
>universally declare variables "my" outside of routines, and MacPerl
>promptly forgets their existence and initial values.

As others have pointed out, it is not so clear whether what you're doing is
really *supposed* to work. While conventional meaning of "lexical scoping"
would imply that it does, the Perl manpages focus on my() being defined only
for a single scope. However, the Perl5.0.2beta3 manpage gives an example which
hints that this is possible.

I'm not aware of having done any modifications to the standard perl source in
this area either. I'll have to look further into this issue.

Matthias

-----
Matthias Neeracher <neeri@iis.ee.ethz.ch> http://err.ethz.ch/members/neeri.html
   "One fine day in my odd past..." -- Pixies, _Planet of Sound_