Hi,
Until now I've written Perl in a quick-and-dirty fashion - single
monolithic .pl file, cutting and pasting from previous code where
convenient, etc. Often I won't even write subroutines. (It's not how
I generally program, but it has filled the bill well for the kinds of
things I've needed.)
Now I'm writing a suite of tools that will share a lot of the same
functionality, and the right thing to do is factor that into a single
source in some way. Something equivalent to #include "foo.c"
I feel like a lame-brain, but I can't really find things in Perl that
seem to provide this.
All of my tools begin with the same initialization code. Somewhere I
saw an example of 'eval "foo.pl";' which would handle this situation,
but that usage isn't obvious to me in the perldoc for eval.
And all of the tools need frequent access to sub's, which I'd like to
have in a separate source file and "include" in the main files.
I suppose what I want is the "module" (I mean, it just *sounds*
right), but from what I've read so far, Perl modules seem to be very
advanced, general-purpose animals - found mainly in CPAN, or in object-
oriented programming. So far I've avoided OO Perl as much as
possible. As an old-school structured/modular programmer, I'm
wondering how other folks handle this need in "smallish" programming
projects.
Thanks a lot. And by the way, I am convinced that Perl, and its
practitioners, are among the best engineers on earth - so, please show
me the way - if I need to learn about modules now, so be it! :-)
Chap Harrison
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/