--- "F.H" <[EMAIL PROTECTED]> wrote:
> Hi there,
> Can you use in a perl script a module with an argument. something like
> use mymodule -myargument;

Why yes, you can use a module with an argument.  Why, just the other day I yelled at 
one of my
coworkers "use DBI.pm, you fool!" :)
 
> I get this message: "-myargument" is not exported bt the mymodule module.
> I tried in the module this
> @mymodule::EXPORT = qw(myargument )
> and still it didn't work.

Now, I'm not sure exactly what you intended when you used the word 'argument', but 
what I *think*
you're looking for is something similar to the following example.  This is from a 
CGI::Safe module
I wrote (but highly edited here):

    ################################
    package CGI::Safe;
    ################################
    $VERSION = 1.0;
    use strict;
    use Exporter;
    use vars     qw/ @ISA @EXPORT_OK /;
    @ISA       = qw/ CGI Exporter /;
    @EXPORT_OK = qw/ get_upload /;

(For those familiar with OO programming, I allow a method to be exported *and* used as 
a function
as this duplicates the look-and-feel of the CGI.pm module).

In the example above, I can use this module in another script as follows:

    use CGI::Safe qw/ get_upload /;

This will import the "get_upload" function.  Only by putting subs or variable names in 
the
@EXPORT_OK array can I import them into another module by explicitly stating them when 
I "use" the
module in question.

If that's a bit confusing, let me know and I'll try to be more clear.

Cheers,
Curtis Poe

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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

Reply via email to