On Tue, Sep 17, 2002 at 06:25:42PM -0000, Cricker wrote:
> I'd like to break my perl script into several files (because it is getting
> awfully large, with all the callbacks from Tk), but still keep the lexical
> scope.  Maybe I'm thinking too much like a C programmer, but I would just
> like to #include callbacks.pl or some such.

You can't split your code up into libraries or modules and still maintain
the same lexical scope.  Each file has its own scope, seperate from the
others.  If your code currently relies on the scope being shared you're
going to have to do some restructuring, either by changing the lexicals to
globals (bad), reworking the code so that each function has what it needs
passed to it as an argument, or moving to an OO model where your object has
all of the data the functions (now methods) will need.

Incidentally, the global variable method is how C accomplishes this.  It's
generally an indication of bad design when you involve too many globals.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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

Reply via email to