Active State Perl : Unable to download modules using ppm - perl

I have downloaded active state perl on a windows 32 bit machine. I have perl file which uses CGI Lite module. So I tried installing it from the command prompt. But its giving me an error. How can I download the desired modules in active state perl using the ppm?
P:\>ppm install CGI-Lite
ppm install failed: Can't find any package that provides CGI-Lite

I got the solution from the following document:
http://community.activestate.com/forum-topic/using-ppm-thru-proxy

By the way the ActiveState's Perl contain cpan utility allowing you to install modules which have no versions in the Repositories. Just type in cmd.exe:
C:\users\roman> cpan CGI::Lite

When you are working under a proxy, run these commands from command prompt:
SET HTTP_proxy=http://proxy:port #for this check your proxy setting
SET HTTP_proxy_user=<your user name> #system user
SET HTTP_proxy_pass=<your password> #password for same user
Read this document for details.

Related

Perl Module install to mentioned directory

I want to install a Perl module to a particular directory which I am mentioning while executing a command.
I want this module to be installed in a mentioned path.
Command I tried is
$ env PERL_MM_OPT='INSTALL_BASE=/home/vinod/my_test_folder/perl_practice/scripts' cpanm Log::Log4perl
But this by default installed in /home/vinod/my_test_folder/perl_practice/scripts/lib/perl5.
What could be the reason? How to install the module in particular directory which I am mentioning?
See the documentation of INSTALL_BASE. You seem to be interested in changing just the INSTALLPRIVLIB path. Maybe you want to set the LIB attribute only, described in the next section?

Unable to Install DBD::Oracle for Perl on Windows

When trying to install DBD::Oracle library i received the following error message "Can't load /usr/lib/perl5/site_perl/5.24/x86_64-cygwin-threads/auto/DBD/Oracle/Oracle.dll for module DBD::Oracle: No such file directory at /usr/lib/perl5/5.24/x86_64-cygwin-threads/DynaLoader.pm"
I installed the DBD::Oracle library on windows using the below steps:
instantclient-basic-11.2.0.4.0
instantclient-sqlplus-11.2.0.4.0
instantclient-sdk-11.2.0.4.0
Then, I unzip them all to c:\Oracle.
Next, I included the below directory in my system environmental on windows as shown below
ORACLE_HOME=C:\Oracle\instantclient_11_2
LD_LIBRARY_PATH=C:\Oracle\instantclient_11_2\lib (There is no lib directory in this folder, but i followed the instructions of an online article regardless)
Finally, I opened command prompt and ran and received that error message:
perl -MCPAN -e "install DBD::Oracle"
I resolved the problem by installing the 32-bit Oracle Client 11g version onto the computer in this location c:\oracle. It doesn't work using the instantclient version because the instant client doesn't contain the necessary libraries.
Download "Oracle Database 11g Release 2 Client (11.2.0.1.0) for Microsoft Windows (32-bit)" from the below link and install the full administrator verion
http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html
Next, create ORACLE_HOME variable in your environmental variables on your computer and add the following path to it: ORACLE_HOME=C:\Oracle\product\11.2.0\client_1
Next, create LD_LIBRARY_PATH variable and add the below path:
LD_LIBRARY_PATH=C:\Oracle\product\11.2.0\client_1\lib
Afterwards, install module using perl without testing it. During the test it will fail, because its trying to connect to your database:
perl -MCPAN -e shell
notest install DBD::Oracle
Open the odbcad32.exe in this location C:\Windows\SysWOW64\ and click Add. Type Oracle for the name and description and click save. The SysWOW64 will connect the 32-bit version of the odbcad32 application to create the reference.
NOTE: The biggest problem you will have is to ensure you are using 32-bit drivers using cygwin, oracle software, and odbcad32. You will receive that can't load library if you mix 64-bit drivers with 32-bit drivers.
Reopen any command prompt window and try running your perl script again.

Installing Net::SFTP and Net::SSH2 without CPAN

I am making a Perl script to fetch files from a Unix Server using SFTP. I want to search the file using Regex and then download it to my system folder. I am using ActivePerl and Windows 64 bit environment. I looked on various posts which suggested the best way is using Net::SFTP::Foreign::Backend::Net_SSH2 but I am facing lots of errors while installing Net::SFTP and Net::SSH2.I cannot CPAN from my system and tried with GCC and dmake. Net::SFTP is halting at Math::Pari and Net::SSH2 is asking for libraries libssh2. I downloaded libssh2 from here but not able to install it.
Also can I use any 3-d part OS tools like psftp through Perl to server my requirements.
1. Net::SSH2 is not in offical PPM repositories. Install it using below:
ppm install http://www.sisyphusion.tk/ppm/Net-SSH2.ppd
Tested on Windows 7 and Perl 5.18.4
2. For Math::Pari check this answer Unable to install Math::Pari module

CPAN first launching configuration

I'm taking a look into Perl as a total beginner. I want to try some CPAN modules.
When I run an install command on my Osx console, CPAN asks for a configuration with the following statement :
To install modules, you need to configure a local Perl library
directory or escalate your privileges. CPAN can help you by
bootstrapping the local::lib module or by configuring itself to use
'sudo' (if available). You may also resolve this problem manually if
you need to customize your setup.
What approach do you want? (Choose 'local::lib', 'sudo' or 'manual')
What is the difference between local::lib and sudo options ?
If I understand it well, it installs some modules locally on my computer. But I don't see any difference between the two config above.
If you use sudo, CPAN will use root to install the libraries in a central location where all users on the machine can access the files without any special configuration. If you use 'local::lib', it will create a library in your home directory and install the modules such that only perl programs that have been configured to look for modules in your home directory will find the modules.
Perl uses the special variable #INC to search for module paths. So you can install modules anywhere as long as you set #INC properly before you use them. This article explains the basics.
http://www.symkat.com/find-a-perl-modules-path
You can do all kinds of fun stuff with #INC; one of my favorite hacks it to put a function pointer in there and use custom perl code to lookup modules.
Good question. When you use local::lib, you can install Modules via CPAN User specific in an given directory. Assume you choose sudo as approach, you install Modules global.
Its like installing Node.js via npm. When you install a module with npm install -g <Modul>, its global installed and you can use it everywhere. But withouth that -g flag, its just available inside your current directory.
Its about the same here, except that you choose the default way of installing CPAN Modules.

Perl Module Installation

I am attempting to install a Perl Module entitled: File-Copy-Recursive and I am following these steps:
1) open cmd.exe
2) perl -MCPAN -e 'install File::Copy::Recursive;'
and I receive the message "It looks like you don't have a C compiler and make utility installed. Trying to install dmake and the MinGW gcc compiler using the Perl Package Manager. This may take a few minutes..."
"Downloading ActiveState Package Repository packlist...failed 500 Can't connect to ppm4.activestate.com:80 (connect: timeout).
Downloading File-Copy-Recursive packlist...not found
ppm.bat install failed: Can't find any package that provides MinGW"
These failed because I am behind a proxy, and I do know the proxy settings but I don't know how to apply them in this situation.
Is anyone aware of any alternative fixes to this solution?
Thank you.
It seems you are using ActiveState Perl, which comes with its own package manager (called PPM) to ease the pain of installing modules, especially those which would normally require a C compiler to be able to install.
Try following the instructions to set up your environment so that PPM knows about your proxy. For example, to set the proxy settings for a single instance of cmd.exe:
C:\>set http_proxy=http://username:password#proxy.example.org:8080
Then, in the same command prompt window, try this (it works for me, though I'm not behind a proxy):
C:\>ppm install File-Copy-Recursive
Note that it's probably a good idea (maybe even required?) to run cmd.exe "As Administrator" to make sure it has full authorization.
EDIT: The particular module you want to use is written in pure Perl. For a quick "installation", you can just download it from CPAN, extract the files, and copy the "Recursive.pm" file into a File\Copy directory structure placed in the same directory as your script:
yourscript.pl
File\
Copy\
Recursive.pm
As an alternative you could try the Strawberry Perl distribution which comes with tools for building XS modules.
Hi
I guess you are using Activestate Perl
look at
http://docs.activestate.com/activeperl/5.10/faq/ActivePerl-faq2.html#what_is_ppm
PPM is installed automatically with ActivePerl.
To use PPM, your computer must be connected to the internet, have access to a PPM repository on a local hard drive or network share, or have access to a mounted ActiveState ActiveDVD.
If you connect to the internet via firewall or proxy, you may need to set the http_proxy environment variable. See PPM, Proxies and Firewalls for more information.