Hi Otto,

Werner Otto wrote on 25.05.2004:

>Hi there,
>
>Is there any way that I can call a specific sub from a cgi script.
>
>i.e.
>
>script1.cgi
>
>sub print1
>{
>   print "hello1";
>}
>
>sub print2
>{
>   print "hello2";
>}
>
>script2.cgi
>
>my messy code:
>require("/home/user/public_html/script1.cgi.script2()");
>
>obviously this does not compile. But the results needed when script2.cgi 
>runs:
>
>perl script2.cgi
>output: hello2

Sounds like you need to roll your own module and put the print2 subroutine into it. 
Then you can utilize it for any number of scripts by

use Module;

Module::print2();

See the Exporter module if you want to avoid adding the module's name to each of the 
sub calls.

- Jan
-- 
There are two major products that come out of Berkeley: LSD and UNIX. We don't believe 
this to be a coincidence. - Jeremy S. Anderson

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to