[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Perl Question
- Subject: [ale] Perl Question
- From: ivey at gweezlebur.com (michael d. ivey)
- Date: Tue Mar 2 09:44:11 2004
- In-reply-to: <1078237547.23190.11.camel@devel>
- References: <[email protected]> <[email protected]> <1078237547.23190.11.camel@devel>
On Tue, Mar 02, 2004 at 09:25:47AM -0500, Chris Fowler wrote:
> I have many perl programs that have common code. I want to somehow
> include a perl program that defines functions for this code. What is
> the best way?
>
> I also want to store variables in a central file and source them like I
> can in bash. I can not find the perl equivalent. How can I do that?
The preferred way would be to write a module (man perltoot) and have all
of your common code in that. Then your programs would
use MyModule;
Alternatively, just stick the common code in a file and
require '/full/path/to/file.pl';
That covers both questions, unless the first one was "I want to write a
program that outputs perl code, and include that in my other program" in
which case you want a combination of eval, backticks, and require. Or a
temp file. But I don't think that's what you meant, anyway.
--
michael d. ivey [McQ] : "The power of accurate observation is
<ivey at gweezlebur.com> : commonly called cynicism by those who
http://gweezlebur.com/~ivey/ : have not got it."
encrypted email preferred : -- George Bernard Shaw