Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Env:Modulecmd issue

by TeTeKe (Initiate)
on May 10, 2017 at 21:48 UTC ( #1190014=perlquestion: print w/replies, xml ) Need Help??

TeTeKe has asked for the wisdom of the Perl Monks concerning the following question:

I'm using Env::Modulecmd (after some searching) in my perl script trying to load my environment module, but somehow it's not working.
Here's a simple command line example,

% perl -e 'use Env::Modulecmd { load => 'VDIkit' }'

This produced the error message below:

Unable to execute 'modulecmd perl load VDIkit':
-> No such file or directory
Error loading module VDIkit at -e line 1
BEGIN failed--complilation aborted at -e line 1.

Please advise,

Replies are listed 'Best First'.
Re: Env:Modulecmd issue
by Mr. Muskrat (Canon) on May 10, 2017 at 22:17 UTC

    The documentation for Env::Modulecmd indicate that the the "module" should exist in your PATH. Is VDIkit in one of the directories within your PATH?

      thanks for the reply.

      Yes, 'VDIkit' module exists on my module path setting $MODULEPATH. Under linux, I can load it fine with "% module load VDIkit"
        But do you have a bin/modulecmd or bin/module or whatever its called in your $PATH?
Re: Env:Modulecmd issue
by thanos1983 (Parson) on May 10, 2017 at 23:18 UTC

    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 42

    In my dir /home/tinyos/Monks I have my module My::Math or My/

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

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1190014]
Approved by beech
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2023-12-04 02:54 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (20 votes). Check out past polls.