Monday, November 10th, 2008
Today I ran into this error:
Base class package “Tree::DAG_Node” is empty.
(Perhaps you need to ‘use’ the module which defines that package first.)
at /usr/lib/perl5/vendor_perl/5.8.8/XML/Validator/Schema/Node.pm line 2
An odd error from perl’s XML Validation libraries; here is how you fix it: install the Tree::DAG_Node package
yum -y install perl-DAG_Node
Monday, January 14th, 2008
Here is how to do a search and replace using Perl regex over a set of files:
perl -pi -e 's/source/destination/g' *.ext
Thursday, August 16th, 2007
If you ever have to set an environment variable you may run into the same reality I ran into.
A simple call to system using export (as you might do on the command line)…
system( "export MYVAR=somevalue" );
…does not work!
You have to use the Perl ENV hash variable:
$ENV{'MYVAR'} = "somevalue";
Changes to $ENV{‘SOMEVAR’} will be available to the current process and children processes only. Thus, if you change an environment variable for an upcoming system() call the process started due to the system() call will see the environment variable change.
Here is an example:
.
.
.
$ENV{'http_proxy'} = "192.168.0.10";
system( "wget --tries=2 --timeout=8 $url" );
.
.
.