> The way I read the Perl docs, I've always been convinced that MacPerl > is being more faithful to them. As far as I can tell, since > "my" variables can never be seen in subroutines below the level that > the variable is declared, declaring them in a package outside of > any routine is pointless, and MacPerl is correct in simply forgetting > them. At first I wasn't sure how that was working, but yes, you're right, from the way the Perl docs also read to me, declaring variables with my in a package ouside of a subroutine should be pointless. > (The other thing the authors of lwp do is use my'ed variables in > the anonymous subroutines used to actually collect data from the socket. > That's in clear violation of the Perl docs, but it works in Unix Perl.) > > But I suppose we should be practical about this. I haven't looked at > very much of the code in the Perl 5 modules archive yet, but > both libwww-perl-5 and NetFTP use the "my" construct to > initialize variables in packages outside of routines. The CGI::* modules and HTML::* modules also do this. > And Unix Perl > (at least on both Suns and HP's) does what these authors expect, > whether or not they're writing code that conforms to the docs. Now > the question becomes whether whatever Unix Perl that's officially > blessed for general use by Larry Wall or the Perl docs are > the authoritative source. And since it's probably easier at this point > to change the docs rather than Perl and a bunch of modules, I assume > that the behavior of Unix Perl is "correct", even if it's not. I > wouldn't be suprised to learn that this is due to some obscure bug in > Unix or Mac yacc/bison (or whatever is used), but should Matthias > "fix" MacPerl or should we raise a stink and try to get the various > module authors to write doc conforming Perl? I think it should be raised to the Perl community at large. I'd be very interested in hearing their opinion on what is actually meant by 'lexically- scoped' variables and the way Perl's 'my' relates to this idea, also if 'my' is working correctly or incorrectly based on that theoretical notion of lexical scoping. I'm sure it would be easier to "fix" MacPerl to work like Unix Perl in this instance, but I'd definitely want to understand wherein the problem lies: Is the documentation off? Is there an exception with packages? Is Unix Perl not working correctly? These are questions that might only be answered by asking the larger Perl community. Michael > --- > -------- > Paul J. Schinder > NASA Goddard Space Flight Center, > Code 693, Greenbelt, MD 20771 USA > schinder@pjstoaster.pg.md.us