skazat has asked for the wisdom of the Perl Monks concerning the following question:

here's a doozy:

i have a fairly big, sophisticated script (80k) that uses the CGI.pm module. i want to have another script that links to the sophisticated script with require

require "bigscript.cgi"

it seems to me that the script fails when i try this, can anyone give me some guidance where the big script will only use the CGI.pm module when used by a browser? theres some yumy functions in the big script i don't feel like having to copy over.

zoom

  • Comment on use the CGI.pm module only when script is used by a browser

Replies are listed 'Best First'.
Re: use the CGI.pm module only when script is used by a browser
by ivey (Beadle) on Jun 06, 2000 at 07:09 UTC
    The easy way:
    strip the code from the CGI into a function library, and require it from both the CGI and the command-line version. should be 3 minutes of effort.

    The better way:
    make a .pm of the functions, maybe even using the OO-style, and then just use it.

    either way will work well.