If the module is a subclass of Exporter (most are), then when you use it, it's import() method gets called, so in the module you would put:
package module; use vars qw/@ISA/; @ISA = qw(Exporter); my $path; sub import { my $self = shift; my %args = @_; # of course you would do something more useful than # just printing it print "The path is $args{path}\n"; # at the very least you probably want to store it # somewhere you can get at it later. $path = $args{path}; }
The arguments after use are passed to import directly as a list, the => sign has the same meaning as a comma, but I like it because it makes it more obvious that the /usr/local/etc/software is related to the path.
| We're not surrounded, we're in a target-rich environment! |
|---|
In reply to Re: Re: Re: Module and software path
by jasonk
in thread Module and software path
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |