in reply to Passing a required script arguments
Because you just typed the subs in foo.pl right there, then you call the subs within it as normal. so, if the sub dothis has been declared in foo.pl - just call it as usual - $rc = dothis( par1, par2 );
You can do all sorts of other stuff, but this is the most basic way of 'including' code from another file. I used this technique a few years back to build hte functional blocks of a large CGI based web-app. Based on the function selected from the menu I couild require the code for that group of functions and then pass the parameters that came back from the CGI.
You are now on the way to your first Perl module! Have fun and look at the documents here regarding modules, it is in fact veryt simple to make a custom module of your own which will make maintenance easier and help with issues of namespace. But that's for another time!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Passing a required script arguments
by Anonymous Monk on Sep 26, 2003 at 15:54 UTC |