Feeds:
Posts
Comments

Archive for the ‘Perl’ Category

I hope this is useful to someone…

This is a small script to find the installed perl modules……

#!/usr/local/bin/perl

use ExtUtils::Installed;
my $instmod = ExtUtils::Installed->new();
foreach my $module ($instmod->modules()) {
my $version = $instmod->version($module) || "???";
       print "$module -- $version\n";
}
#./list-modules.pl
Apache::DBI -- 0.94
Archive::Tar -- 1.30
Authen::SASL -- 2.08
Authen::Smb -- 0.91
CGI -- 3.11
CPAN -- 1.87
Compress::Zlib -- 1.42
Convert::ASN1 -- 0.18
Cwd -- 3.19
DBD::Oracle -- 1.12
DBI -- 1.48
Data::Dumper -- 2.102
Date::Manip -- 5.42
Digest -- 1.10
Digest::MD5 -- 2.36
Error -- 0.15
Getopt::Long -- 2.34
HTML-Tree -- ???
HTML::Macro -- ???
HTML::Parser -- 3.40
HTML::Tagset -- 3.03
IO::Socket::SSL -- 0.96
IO::String -- 1.06
IO::Zlib -- 1.04
List::Util -- 1.17
MIME::Base64 -- 3.05
Mail::Sender -- 0.8.10
Net -- ???
Net::LDAP -- 0.32
Net::SSLeay -- 1.25
Net::Server -- 0.94
Net::Telnet -- 3.03
Number::Format -- 1.45
OLE::Storage_Lite -- 0.14
PDF::Create -- 0.01
Perl -- 5.6.1
SQL::Statement -- 1.09
Term::ReadKey -- 2.30
Term::ReadLine -- ???
Test::Harness -- 2.52
Test::Simple -- 0.60
Text::CSV_XS -- 0.23
TimeDate -- ???
URI -- 1.35
XML-DOM -- ???
XML::NamespaceSupport -- 1.09
XML::Parser -- 2.34
XML::RegExp -- 0.02
XML::SAX -- ???
XML::Simple -- 2.14
libwww-perl -- ???
libxml-perl -- ???
mod_perl -- 1.26

Source:

http://www.nntp.perl.org/group/perl.jpl/2004/06/msg212.html

Read Full Post »

Perl modules may be installed using the CPAN module or from source.
CPAN method

perl -MCPAN -e shell (to get an interactive CPAN shell)
perl -MCPAN -e ‘install Time::JulianDay’ (if you know the name of the module, you can install it directly without interacting with the CPAN shell)

Within the CPAN shell:
i /expression/ will search for a Perl module containing expression, and
install module will install the module.

Example:
perl -MCPAN -e shell
i /JulianDay/
install Time::JulianDay

Note: if you are behind a firewall, you may wish to use passive FTP with Perl’s Net::FTP module. Set the environment variable FTP_PASSIVE 1 (or any non-zero value) to use passive FTP when downloading Perl modules through CPAN.

Manual installation

To manually install a Perl module:

1. Download the Perl module from CPAN or other site.
2. Extract the tarball.
3. Run perl Makefile.PL
4. Run make
5. Run make test
6. Run make install

Note: you should use the same compiler to build Perl modules that you used to build Perl. For example, if you are building Perl modules with gcc and are using a version of Perl that was supplied with your distribution (ex. Solaris 8 includes Perl 5.005_03), you may run into errors.

Example: building Perl DBI with gcc on Solaris 8 system with Perl 5.005 (part of the Solaris 8 release).

cc: unrecognized option `-KPIC’
cc: language depend not recognized

The Makefile for Perl modules is created using flags for SUNWspro (the compiler used to build Perl 5.005 for the Solaris 8 release), not gcc. As a workaround, you could build Perl from source using the gcc compiler, or obtain a packaged version of Perl that is built with gcc, such as those at Sunfreeware. This comp.lang.perl.modules post has more information.
Checking for existence of a Perl module
An easy way to check for the existence of a Perl module on your system (technically, in Perl’s @INC array, a list of directories Perl searches when attempting to load modules) is to run perl -e ‘use module;’

Example:

perl -e ‘use HTML::Parser;’

If nothing is returned, Perl was able to locate the module. Otherwise, you will see Can’t locate HTML/Parser.pm in @INC.

Read Full Post »

This HowTo Explains the steps needed to install perl’s DBD::Oracle module on servers running Oracle 9.2.

1. Login to the desired machine:

% sudo su –

2. perform the following:

# grep ORACLE /home/oracle/.bash_profile

3. cut and paste the following export commands from the previous grep

# export ORACLE_SID=
# export ORACLE_BASE=/u01/app/oracle
# export ORACLE_HOME=$ORACLE_BASE/product/920
# export LD_LIBRARY_PATH=$ORACLE_HOME/lib

4. change to the work directory:

# cd /usr/local/src

5. grab the following files

DBD-Oracle-1.16.tar.gz
DBI-1.48.tar.gz
public.tgz

6. Perform the following commands

# cd $ORACLE_HOME/rdbms
# tar zxf /usr/local/src/public.tgz
# cd demo
# ln -s ../public/*.h .
# ln -s ../public/*.mk .
# cd ..

7. change the owner:group of the public directory to match those of
the other directories in rdbms:
e.g.

# chmod -R oracle:dba public

8. Return to the work directory:

# cd /usr/local/src

9. Decompress the DBI sources:

# tar zxvf DBI-1.48.tar.gz

10. Build and install perl DBI

# cd DBI-1.48
# perl Makefile.PL
# make
# make test
# make install
# cd ..

11. Decompress the DBD::Oracle sources
# tar zxf DBD-Oracle-1.16.tar.gz

12. Build and install perl DBD::Oracle

# cd DBD-Oracle-1.16
# perl Makefile.PL
# make
# make test
# make install
# cd ..

13. Remove the work directories

# rm -rf DBI-1.48
# rm -rf DBD-Oracle-1.16

14. You’re all done. Contact the requestor and have them test their scripts.

NB.
You can ignore the warnings from the builds, as long as you see that the ‘make install’
says ‘OK’.

Read Full Post »