[JaxPM] Require
Steve Lane
sml at zfx.com
Fri Feb 9 12:46:33 CST 2001
On the jacksonville-pm-list; Jax.PM'er Steve Lane <sml at zfx.com> wrote -
if this is a short-term thing, i think require() is fine to use.
just put your subs in a file called "WHATEVER.pl" (replace WHATEVER
with a reasonable name, of course), add a "1;" statement at the
end of the file (both use() and require() need this), and in your
"driver" program, add:
require 'WHATEVER.pl';
for a long-term solution, you should consider making a real module,
making it object-oriented if at all appropriate, using use(), and
possibly using Exporter if worthwhile.
feel free to ask if you want more info on making a module,
or type `perldoc perlmod` (actually, run that command and read
the doc before doing anything else).
CGR Online wrote:
> Is there a way I can take all the sub routines and place them in a file of
> it's own and refer to them in the perl program. I've heard of use and
> require but not sure if that is what I would use if it's possable.
>
> synopsis
>
> I got a perl program with 5 million (slight exag) sub routines in it.
> I will create 2 or 3 more perl programs that will use the exact same
> routines in it.
> I want to be able to put the routines in a seperate file and refer to them
> as needed.
--
Steve Lane <sml at zfx.com>
Jax.PM Moderator's Note:
This message was posted to the Jacksonville Perl Monger's Group listserv.
The group manager can be reached at -- owner-jacksonville-pm-list at pm.org
to whom send all praises, complaints, or comments...
More information about the Jacksonville-pm
mailing list