SPUG: Confusing behaivior with exported variables

Tye McQueen tyemq at cpan.org
Mon Mar 23 18:06:33 PDT 2009


On Mon, Mar 23, 2009 at 3:24 PM, Mark Mertel <mark.mertel at yahoo.com> wrote:

> Globals are not recommended. You could make them package variables and
> declare them with 'my' or 'our', and then access them using the package name
> $Neo::Web::Session, or $Darley::Supers::CurrentUser when from outside the
> package.
>

You are muddling several different things together there.

Complaining about "globals" and then recommending "our" is contradictory
since "our" is used to declare a global variable.

Recommending "my" along with "using the package name" is bad advice since it
won't work (you would be accessing different variables).

I'll leave the in-depth explaining of the differences between "lexical
variables" and "package globals" to other sources, but those are the two
choices. :)

Tye
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/spug-list/attachments/20090323/10771ae9/attachment.html>


More information about the spug-list mailing list