cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1262
Views
12
Helpful
7
Replies

adding a perl module to CiscoWorks PERL !?

Martin Ermel
VIP Alumni
VIP Alumni

I have written a perl script to get some info form LMS and store it into a file. Now I want to SFTP this file onto a network share. I want to implement this in Perl as well but on my solaris box (having the solaris perl installed) I cannot find an according module. When I try to install 'Net-SFTP-Foreign' I have problems because I have the wrong compiler. Now I want to know if it is save to add this module to the CiscoWorks Perl version. Or will I run into problems?

Any other suggestion on how to realize this is pretty welcome!

7 Replies 7

yjdabear
VIP Alumni
VIP Alumni

Could you just put the sftp commands in the exec() or system() wrapper in perl, so you can bypass installing the third-party perl modules altogether? Assuming OpenSSH is installed on the box.

I thought of this also but the sftp is interactive and I think I would need something like an Expect module...

or isn`t this true?

Do not add any modules to CiscoWorks' Perl as this could mess up upgrades. As an alternative to installing modules, just keep your modules in a local directory, and use perl -I to find them. For example:

perl -I/export/home/marcus/lib/perl script.pl

Expect is another way to go. With expect, you could easily just wrap the box's sftp executable. Of course, this will mean writing some TCL code.

Ok, when I want to keep the module in a local dir can I use CiscoWorks' version of Perl to install the modules?

When I use the 'standard' version of my solaris box (/usr/bin/perl) I have got the following 2 problems:

1) prerequisite failed

2) when I want to install the missing module it cannot be compiled (thats the main problem..)

but I think it should work if I would use CiscoWorks' Perl. But what is the correct command to install the modules with /opt/CSCOpx/bin/perl in a local directory (like /usr/perl5/myCPAN) without running into prolblems with LMS

##### this is an excerpt of what I get when trying to install the modules

bash-2.05# perl Makefile.PL

Checking if your kit is complete...

Looks good

Warning: prerequisite Scalar::Util failed to load: Can't locate Scalar/Util.pm in @INC (@INC contains: /usr/perl5/5.6.1/lib/sun4-solaris-64int /usr/perl5/5.6.1/lib /usr/perl5/site_perl/5.6.1/sun4-solaris-64int /usr/perl5/site_perl/5.6.1 /usr/perl5/site_perl /usr/perl5/vendor_perl/5.6.1/sun4-solaris-64int /usr/perl5/vendor_perl/5.6.1 /usr/perl5/vendor_perl .) at (eval 4) line 3.

Warning: prerequisite Test::More failed to load: Can't locate Test/More.pm in @INC (@INC contains: /usr/perl5/5.6.1/lib/sun4-solaris-64int /usr/perl5/5.6.1/lib /usr/perl5/site_perl/5.6.1/sun4-solaris-64int /usr/perl5/site_perl/5.6.1 /usr/perl5/site_perl /usr/perl5/vendor_perl/5.6.1/sun4-solaris-64int /usr/perl5/vendor_perl/5.6.1 /usr/perl5/vendor_perl .) at (eval 5) line 3.

Writing Makefile for Net::SFTP::Foreign

bash-2.05#

### OK- because of the warnings I want to install List::Util and get the following error...

bash-2.05# perl Makefile.PL

Checking if your kit is complete...

Looks good

Writing Makefile for List::Util

bash-2.05# make

cp lib/List/Util.pm blib/lib/List/Util.pm

cp lib/Scalar/Util.pm blib/lib/Scalar/Util.pm

/bin/perl "-Iinc" -I/usr/perl5/5.6.1/lib/sun4-solaris-64int /usr/perl5/5.6.1/lib/ExtUtils/xsubpp -typemap /usr/perl5/5.6.1/lib/ExtUtils/typemap -typemap mytypemap Util.xs > Util.xsc && mv Util.xsc Util.c

cc -c -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xO3 -xdepend -DVERSION=\"1.19\" -DXS_VERSION=\"1.19\" -KPIC -I/usr/perl5/5.6.1/lib/sun4-solaris-64int/CORE -DPERL_EXT Util.c

/usr/ucb/cc: language optional software package not installed

make: *** [Util.o] Error 1

bash-2.05# make test

cc -c -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xO3 -xdepend -DVERSION=\"1.19\" -DXS_VERSION=\"1.19\" -KPIC -I/usr/perl5/5.6.1/lib/sun4-solaris-64int/CORE -DPERL_EXT Util.c

/usr/ucb/cc: language optional software package not installed

make: *** [Util.o] Error 1

bash-2.05# make install

cc -c -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xO3 -xdepend -DVERSION=\"1.19\" -DXS_VERSION=\"1.19\" -KPIC -I/usr/perl5/5.6.1/lib/sun4-solaris-64int/CORE -DPERL_EXT Util.c

/usr/ucb/cc: language optional software package not installed

make: *** [Util.o] Error 1

bash-2.05#

### and according to a sun doc this is due to different versions of compilers (the one used on the solaris box and the one with which the module was generated)

No, this problem indicates you don't have a compiler installed. You need to install the Sun Forte compiler if you want to use Sun's cc.

If you just want to compile stuff, I recommend checking out Blastwave (http://www.blastwave.org). This site makes third-party package management a breeze for Solaris. Here you can find the GNU C compiler, which will allow you to build native Perl modules.

Once you get a good compiler on your server, you can build your Perl modules by specifying an alternate installation prefix:

make PREFIX=/home/marcus/lib/perl

Then when you install the module, it will go where you want it to go. Note: you should do the installation as a non-root user so that modules that are not PREFIX-safe don't corrupt your CiscoWorks installation.

Oh, it's not me who want to use cc, - it's 'make' who want to use it... (I just want to add a module to my installed version of Perl..;-) )

As I have previously installed a mdoule (libnet-1.19 to get Net::FTP) without a problem I thought I should have all I need- but from what you say (if I understand correct) not every perl module needs a C compiler to get installed.

And now I am at the point that I want to install a perl module that needs a C compiler. And - is that correct? - my 'Sun' Perl wants to use the Forte C compiler (cc) with which my 'Sun' Perl was built. And because I don't have it I will run in that error.

Now, I have the option to get a running (GNU) C compiler (gcc) from e.g. http://www.blastwave.com and have to force my 'Sun Perl' to use this compiler instead (gcc instead of cc) along with the Solaris::PerlGcc module to get around some other dependencies as mentioned here: http://sunsolve.sun.com/search/document.do?assetkey=1-25-11339)

Or to just get the Forte C compiler (e.g. along with a version of SunStudio)

mhm, I don't like both versions much - but I think I will try the later one to keep it kind of 'homogene'

If you want to use an alternate C compiler with Perl, just set the CC environment variable. Most modules with honor that.

% setenv CC=/opt/csw/gcc3/bin/gcc

% perl Makefile.PL

% make

...

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: