Yes. Here is how

1) In your MyPackage.pm, you import the Exporter module as

require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(init doThis doThat);

2) install MyPackage in a search directory, i.e., including your path in
@INC

3) Then in your scr.pl or other programmer's scripts

use MyPackage;

Those subs will be imported into the scripts.

Hanming


-----Original Message-----
From: Edwin Günthner [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 10:30 AM
To: [EMAIL PROTECTED]
Subject: magic import of extensions?


Hi there,

I am wondering if it is possible to create my own module
and to allow programers to use it without any importing or so.

For example, if MyPackage has subs like "init", "doThis", 
"doThat" - is it possible to have a script that looks like:

scr.pl:

init;
doThis $someArg;
doThat $anotherArg $oneMore;

and just run it with 

> perl scr.pl

.. so what I am looking for is a mechanism
to automatically load MyPackage whenever
Perl starts. Is that possible?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to