develooper Front page | perl.perl5.porters | Postings from July 2012

Re: [perl #113974] package NAMESPACE manpage comments

Thread Previous | Thread Next
From:
David Golden
Date:
July 5, 2012 12:01
Subject:
Re: [perl #113974] package NAMESPACE manpage comments
Message ID:
CAOeq1c_LkYOE5O_Hy-Du1V0=nGozVqr-yt6-uCBYo=CwX_SqyQ@mail.gmail.com
On Thu, Jul 5, 2012 at 11:36 AM, Linda W <perl-diddler@tlinx.org> wrote:
> OBSOLETE?!?
>
> What replaces this functionality? as shown above, 'our' doesn't
> work.

Nothing replaces it.  The intent is that (under strictures)
programmers should either use "our" in *every* scope they need a short
alias to a package variable, or they should use the fully qualified
name.

That said, I think that "obsolete" is not a valid term per perlpolicy,
and it should probably be changed in the documentation to
"discouraged", to make it clear that it's not going away, but that
people should think twice (or three times) before using it for new
code.

FWIW, in your A/B example, I would probably write it to have package B
be a *nested* scope within package A, rather than having three
successive scopes A/B/A.  For me, repeated namespaces in serial scopes
are a code smell -- a sign that I haven't sufficiently modularized the
code.

Regards,
David

Thread Previous | Thread Next


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