Howdy List, 

Bit of a quandry here.

I have a script that does everything it's supposed to.

It's basically like this:
----------------------
Configuration variables here:

Program flow here with a single print statement after 
it figures out what it's doing based on the configuration and user input.
------------------
Now I need to use this same script lots of times so I already have differen 
configurations saved as different modules then in the script all I have to do is:
------------
In One.cgi:
 use Special::One;
# this brings in all the configuartion stuff for 'One'

Rest of script here that uses the variables set up in the module above
------------
In Two.cgi:
 use Special::Two;
# this brings in all the configuartion stuff for 'Two'

Rest of script here that uses the variables set up in the module above
------------
What I'd like to do is this:

 use Special::Blah; # set the configuration
 use Special; # imports one function, doscript(),which is basically the "rest of the 
script"
 print doscript();


Where doscript() basically contains the "rest of the script" mentioned above and 
replaces 
the print with return at the end.

That way I can do all the configs I want and if I change the script I only have to 
change it in one place instead of every script.

So my question for all you experienced module folks is this:

1) If I do it that way is there anythign special I need to do to get the 
variables and things imported by 
use Special::Blah; able to be used in the routine doscript(); ??

Does that make sense?

2) Am I thinking correctly about how doscript() would work?
        IE
        before in script: 
        if($this =~ m/$that/) { ....
        elsif($the =~ m/$other/) { ...
        else { ...
        
        print $results;

        after in script:
                use Special; # imports doscript();

        package Special;
        ...
        sub doscript {
                if($this =~ m/$that/) { $results = mysubhere(); }
                elsif($the =~ m/$other/) { ...
                else { ...

                sub mysubhere {....}    

                return $results;
        }

3) Am I just crazy?

TIA

Dan






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

Reply via email to