Paul makes a good point...normally, you don't want to do what I just
proposed...take a look at Config::General;

my $obj = new Config::General( -LowerCaseNames => 1, -file => $filename,
-AllowMultiOptions => 0 );

It usues a hash to handle passing in arguments in the constructor.  If you
are not making a class, but instead are only making a collection of
functions, then you might ask yourself why you have state...usually a
collection of functions does not have state associated with the collection
(however it can have state in a variable that is passed from function to
function...but then you can just make it an object ;)

I would examine some of the CPAN modules to see how they pass arguments to
constructors before embarking on passing an argument to a module (although
it does bring up some interesting ideas :)

Tanton
-----Original Message-----
From: Paul Johnson
To: F.H
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: 8/16/2001 4:03 PM
Subject: Re: arguments with a module

On Thu, Aug 16, 2001 at 04:52:09PM -0400, F.H wrote:
> what I mean by argument is a switch/option that I pass to the module
that I call whithin my main perl script. Yes I have those line in my
module:
> >use vars qw( @EXPORT, @ISA );
> >@EXPORT = qw( function_name );
> >@ISA = qw( Exporter );
> >require Exporter
> the module is so long that is not worth posting over here. All I need
is to be able to pass an argument/switch  to it, in my case is a file
name.
> so I need to have something like
> use mymodule -myargument=<value>
> 
> I hope I am a little clearer this time.

What you are after is almost certainly done better by some other means.
Maybe you should call a function.  If it's OO maybe the argument should
be passed to the constructor.  Maybe you should derive sub classes.
Maybe you should set a global variable (but probably not).

However, if you really want to do what you asked for, you can write your
own import() sub in your module, and then you can do whatever you want
with it.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
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