February 2012

Perl - How to get the list of CPAN modules installed and its version

To get the list of modules installed on the linux / unix machine and its version.

#!/usr/local/perl/bin/perl
use ExtUtils::Installed;
my $inst = ExtUtils::Installed->new();
my @modules = $inst->modules();
foreach my $module ( @modules ) {
eval "require $module";
printf( "%-20s: %s\n", $module, $module->VERSION ) unless ( $@ );
}

Apache : How to check the httpd version

How to check which version of Apache installed?

Use httpd -v command to get the version of the apache.
Type this command inside the apache/bin directory or type {apache installation path}/bin/httpd -v.

Apache : How to check the list out modules compiled with Apache?

Use httpd -l command to get the list of modules compiled with apache installed.

Perl: How to split the word into characters?

my $word = "test";
my @chars_arrary = split(//,$word);

Perl : How to split the sentence into words?

my $sentence ="I love nature";
my @words_array = split(/ /,$sentence);

Perl : How to remove the special characters like (-, :, . from given sentence or word)?

my $text = "I : have - many .ideas::";
$text=~s/[^\w\d]//g

It will remove all characters other than alphabets, numbers and _

Oracle 11g installation - DBD/Oracle/Oracle.so' for module DBD::Oracle: ld.so.1: perl: fatal: libclntsh.so.8.0: open failed

I have used oracle 8i and migrated to 11g. For perl i have installed DBD::Oracle. When i access the application. I got following error in error log

DBIx::Class::Schema::throw_exception(): Can't load '/usr/perl/lib/site_perl/5/sun4-solaris/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: ld.so.1: perl: fatal: libclntsh.so.8.0: open failed: No such file or directory at /usr/perl/lib/5/sun4-solaris/DynaLoader.pm line 203.