<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:tahoma, new york, times, serif;font-size:12pt"><DIV><FONT face=Tahoma size=2>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Tye McQueen &lt;tyemq@cpan.org&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Mark Mertel &lt;mark.mertel@yahoo.com&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">Cc:</SPAN></B> Peter Darley &lt;pdarley@kinesis-cem.com&gt;; spug-list@pm.org<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Monday, March 23, 2009 6:06:33 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: SPUG: Confusing behaivior with exported variables<BR></FONT><BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: tahoma, new york, times, serif">
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV class=gmail_quote>On Mon, Mar 23, 2009 at 3:24 PM, Mark Mertel <SPAN dir=ltr>&lt;<A href="mailto:mark.mertel@yahoo.com" target=_blank rel=nofollow ymailto="mailto:mark.mertel@yahoo.com"><FONT color=#0000ff>mark.mertel@yahoo.com</FONT></A>&gt;</SPAN> wrote:<BR>
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: tahoma, new york, times, serif">
<DIV></DIV>
<DIV>Globals are not recommended. You&nbsp;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&nbsp;from outside the package.</DIV></DIV></DIV></BLOCKQUOTE>
<DIV><BR>You are muddling several different things together there.<BR><BR>Complaining about "globals" and then recommending "our" is contradictory since "our" is used to declare a global variable.</DIV>
<DIV>&nbsp;</DIV>
<DIV><STRONG>Using 'our' is only global within the package and its descendents. For the external scripts it would not be visible, hence, not global.</STRONG><BR><BR>Recommending "my" along with "using the package name" is bad advice since it won't work (you would be accessing different variables).</DIV>
<DIV>&nbsp;</DIV>
<DIV><STRONG>It does work:</STRONG></DIV><STRONG></STRONG></DIV>
<DIV class=gmail_quote>&nbsp;</DIV>
<DIV class=gmail_quote><STRONG>package Foo;</STRONG></DIV>
<DIV class=gmail_quote><STRONG>my $bar = "foo bar\n";</STRONG></DIV>
<DIV class=gmail_quote><STRONG>1;</STRONG></DIV>
<DIV class=gmail_quote><STRONG>...</STRONG></DIV>
<DIV class=gmail_quote><STRONG></STRONG>&nbsp;</DIV>
<DIV class=gmail_quote><STRONG>use Foo;</STRONG></DIV>
<DIV class=gmail_quote><STRONG>use strict;</STRONG></DIV>
<DIV class=gmail_quote><STRONG></STRONG>&nbsp;</DIV>
<DIV class=gmail_quote><STRONG>print $Foo::bar; # prints 'foo bar'</STRONG></DIV>
<DIV class=gmail_quote><STRONG></STRONG>&nbsp;</DIV>
<DIV class=gmail_quote><STRONG>print $bar; # should throw an error</STRONG></DIV>
<DIV class=gmail_quote><BR><BR>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. :)<BR><BR>Tye<BR></DIV></DIV></DIV></div><br>

      </body></html>