in reply to Env:Modulecmd issue
Hello ,
Why don't you want to load your module normally, is there any reason?
For example:
#!/usr/bin/perl use strict; use warnings; =alternative BEGIN { push ( @INC,"/home/tinyos/Monks/"); } use My::Math qw(add); =cut use lib qw(/home/tinyos/Monks); use My::Math qw(add); my $addition = add(19, 23); print $addition . "\n"; __DATA__ $ perl test.pl 42
In my dir /home/tinyos/Monks I have my module My::Math or My/Math.pm.
Sample of module for replication purposes:
package My::Math; use strict; use warnings; use Exporter qw(import); our @EXPORT_OK = qw(add multiply); sub add { my ($x, $y) = @_; return $x + $y; } sub multiply { my ($x, $y) = @_; return $x * $y; } 1;
Simple straight forward and the job is done.
Hope this helps.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Env:Modulecmd issue
by TeTeKe (Initiate) on May 10, 2017 at 23:32 UTC |