For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > November 2005 > RE: our..... Lou's code ( was: Need help with making a Modules )









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author RE: our..... Lou's code ( was: Need help with making a Modules )
Charles K. Clarkson

2005-11-28, 6:55 pm

Lou Hernsen <> wrote:

: Bob Showalter <> wrote:
:
: : A variable declared with "my" is only accessible within the
: : enclosing file, block, or eval.
:
: File is the entire program.

Yes.

: like a global var?

No. Globals are in the symbol table and can be accessed from
*outside* the file. File scoped lexicals can only be accessed
from *inside* the file.


: Block is the "if" or "while" or other {} framed code?

Yes.


: what is an eval?

A perl function. Read perlfunc or type "perldoc -f eval" from
the command line (DOS box).


: : "our" is a declaration that allows you to use a global
: : (symbol-table) variable name without a package qualifier when
: : "use strict" is in effect.
:
: from what you say "our" is used in the main program

It can be used in any file. The main program or a module which
uses the "strict" module.


: so I don't have to declare them again in the mod?

No. You should be importing the module subroutines into the
"main" namespace. So your program will "think" the subroutine and
variables are from "main".

If you are not using "strict" you don't need "our".


: So if I run the mod as one big ad-in program to main
: and not calling subs in the mod, I don't have to pass vars in the
: ()'s? stats;
: and not
: stats::sub($var1, $var2, etc....);

Yes. I showed an example in the "Need help with making a
Modules" thread.


HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328

. . . With Liberty and Justice for all (heterosexuals).

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com