quick perl question
Phil Buckley
phil at 1918.com
Thu Feb 10 17:13:44 EST 2000
Ahhh, that was it...
Thanks
Phil
*********** REPLY SEPARATOR ***********
On 2/10/00 at 4:57 PM John Chambers,,,781-647-1813 wrote:
><jabr at blu.ORG> scribbled:
>
> On Thu, 10 Feb 2000 Phil Buckley <phil at infoinsomniax.com> wrote:
>
> > A bit off topic, but I know someone out there will have this on the top
> > of their head...
> >
> > I want to pull in a cgi script that holds a handful of common functions.
> > I thought the proper syntax was something like:
> >
> > #!/usr/bin/perl
> >
> > use "common.cgi";
> >
> > but apparently it isn't.
> >
> > Can someone please gimme a quick dope-slap and remind me.
>
> *thwap*
>
> use CGI qw/:standard/;
>
>Nice slap, but wrong answer. This doesn't do the same thing at
>all, and it's not what was asked for. More likely, the answer
>should be:
>
> require "common.cgi";
>
>This will read in the file, and compile its contents into the
>program. It's a run-time command, unlike "use", which happens
>at compile time. The "use" command also does some other things
>that you probably don't want done if you're just trying to load
>in a few of your own routines.
>
>Note that "common.cgi" should end with:
> 1;
>
>The require command expects a return value that tells it whether
>the package thinks it was loaded successfully. This tells require
>that everything was loaded OK (and a second require of the same file
>will be a no-op).
>
>-
>Subcription/unsubscription/info requests: send e-mail with
>"subscribe", "unsubscribe", or "info" on the first line of the
>message body to discuss-request at blu.org (Subject line is ignored).
-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).
More information about the Discuss
mailing list