Safety net for Perl
Perl by default is very forgiving. In order to make it more robust it is recommended to start every program with the following lines:
#!/usr/bin/perl
use strict;
use warnings;
The two additional lines request from perl to catch various common problems in your code. They check different things so you need both. A potential problem caught by use strict; will cause your code to stop immediately when it is encountered, while use warnings; will merely give a warning (like the command-line switch -w) and let your code run.
To read more about them check their respective manual pages at strict and warnings.
Enable ImageMagick perl module for perl/cgi script.
1. Install ImageMagick-perl package corresponding to ImageMagick rpm installed on the server shipped by OS vendor.
e.g.
# rpm -q ImageMagick
ImageMagick-6.0.7.1-12
#rpm -ivh ImageMagick-perl-6.0.7.1-12.i386.rpm
OR
1. You can use up2date or yum to install/upgrade ImageMagick-perl package
# up2date ImageMagick-perl
or
#yum install ImageMagick-perl
2. Run ensim through maintenance mode.
set_pre_maintenance
set_maintenance
set_post_maintenance
service webppliance restart
Reference: http://parallels.com
CPAN - query, download and build perl modules from CPAN sites
Interactive mode:
Batch mode:
use CPAN;
autobundle, clean, install, make, recompile, test
Example:
root@laptop:~# perl -MCPAN -e shell
Terminal does not support AddHistory.
cpan shell -- CPAN exploration and modules installation (v1.9205)
ReadLine support available (maybe install Bundle::CPAN or Bundle::CPANxxl?)
cpan[1]> test
CPAN: Storable loaded ok (v2.18)
CPAN: LWP::UserAgent loaded ok (v5.819)
CPAN: Time::HiRes loaded ok (v1.9711)
I would like to connect to one of the following sites to get ‘authors/01mailrc.txt.gz’:
http://www.perl.org/CPAN/
ftp://ftp.perl.org/pub/CPAN/
Is it OK to try to connect to the Internet? [yes]
Source: Man Page - http://theoryx5.uwinnipeg.ca/CPAN/perl/lib/CPAN.html
How to install missing perl modules.
What is CPAN?
CPAN is the Comprehensive Perl Archive Network, a large collection of Perl software and documentation. You can begin exploring from either http://www.cpan.org/, http://www.perl.com/CPAN/ or any of the mirrors listed at http://www.cpan.org/SITES.html.
Note that CPAN is also the name of a Perl module, CPAN.pm, which is used to download and install Perl software from the CPAN archive. This FAQ covers only a little about the CPAN module and you may find the documentation for it by using perldoc CPAN via the command line or on the web at http://search.cpan.org/dist/CPAN/lib/CPAN.pm
Cpan is the easiest method to install new perl modules.
perl -e shell -MCPAN
install Bundle::DBD::mysql
Using perl to make custom changes to files
The below example shows how to make changes to the virtual host conf files. Here we are changing CustomeLog to #CustomLog.
perl -pi -e ’s/CustomLog/#CustomLog/’ virtual_host*.conf