Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Env:Modulecmd issue

by thanos1983 (Parson)
on May 10, 2017 at 23:18 UTC ( [id://1190023]=note: print w/replies, xml ) Need Help??


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.

Seeking for Perl wisdom...on the process of learning...not there...yet!

Replies are listed 'Best First'.
Re^2: Env:Modulecmd issue
by TeTeKe (Initiate) on May 10, 2017 at 23:32 UTC
    My modules are environment modules, which are used to setup environment variables for specific EDA tools (cadence,mentor,etc..) so they can be invoked correctly.
    Thanks,
    teteke

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1190023]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-19 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found