Actually, I'm not writing a package, per se, here...  (I do use 'use
strict' in my packages) ...  This is the main program that I'm writing
in which I use globals...  I'll start playing with the use strict stuff
in my main program since that appears to be the "proper" way to do
things...  :)

---------------------------
Jason H. Frisvold
Senior ATM Engineer
Engineering Dept.
Penteledata
CCNA Certified - CSCO10151622
[EMAIL PROTECTED]
---------------------------
"Imagination is more important than knowledge. Knowledge is limited.
Imagination encircles the world." -- Albert Einstein [1879-1955]


-----Original Message-----
From: Bob Showalter [mailto:[EMAIL PROTECTED]] 
Sent: Monday, May 06, 2002 11:34 AM
To: Jason Frisvold; [EMAIL PROTECTED]
Subject: RE: use strict

> -----Original Message-----
> From: Jason Frisvold [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 06, 2002 11:19 AM
> To: [EMAIL PROTECTED]
> Subject: use strict
> 
> 
> I have a question about 'use strict'  ...  Yeah, I guess this 
> counts as
> a "duh!" question...  :-)
> 
> I put 'use strict' at the beginning of one of my scripts...  It
> basically "broke" the script...  (or fixed it, if you want to 
> look at it
> that way) ....  The problem is that it wanted explicit 
> package names for
> all of the globals...
> 
> So, what is the proper way to handle a global?  Do I 'my' all the
> globals in the program?

probably, yes.

"use strict" is there to help you catch typos, by forcing you to
either declare all variables or use explicit package names.

Generally you will want to declare your globals with "my" at the
top of your script. This creates file-scoped lexicals, which are
similar to globals in terms of visibility, but do not live in the
symbol table.

If you really need symbol table (i.e. "package") variables, then 
use "our" instead of "my". The main reason you would need a package
variable is if the variable needs to be accessed from another
file or module directly, instead of being passed as an argument.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to