On Friday, Sep 20, 2002, at 05:50 US/Pacific, Cricker wrote:
[..]
> So what I was thinking of doing was something like:
>
> my ($a,$b);
>
> # main code
> ...
>
> #include "subs1.pl"
> ...
>
> where code in subs1.pl made reference to $a and $b.  I realize that I 
> can do
> this with globals.  So that's what I'll do.

As an initial solution - I think that would work.

you may want to think about

        http://perl.plover.com/FAQs/Namespaces.html

and that in the longer run having a clean API for your subs
that do not rely upon global side effects will be simpler to
maintain... I concede that there are a lot of times when one
needs to have functions that cause a global side effect - such
as signal handlers

        my $run_flag = 1;
        $SIG{HUP} = sub { $run_flag = 0};

        while($run_flag) {
                # do our main loop
        }

Which I think is one of the rules that I general use about
deciding if a given function needs/can/should_be moved into
a perl module...

ciao
drieux

---


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

Reply via email to