How To Install/Update CPAN on MacOS Mojave with fatal error: ‘EXTERN.h’ file not found

Author: , June 12th, 2019

The Problem Tried to install the latest version of cpan and got stuck. Tracked it down to the dependency module Mac::SystemDirectory which was failing to build:

The Solution Use the MacOS installer command to deploy the needed files:

The, rerunning the cpan install works:

How To Use Regex Negative Lookahead To Exclude Strings

Author: , May 31st, 2019

I have a task in Perl to list specific files based on pattern match, those with and those without the string “_from_”. There are two files in the directory to filter: To capture the files with the _from_ string was easy:

To capture the files WITHOUT the _from_ string was not quite […]

How To Reformat or Re-indent Files in VIM

Author: , January 11th, 2019

In the normal vim mode, typing gg=G will reindent the entire file. == will re-indent just the current line.

How To Calculate Dates In Perl Using Date::Manip

Author: , September 18th, 2017

How To Watch https Calls to Apache 2.4 using Perl and mod_status

Author: , September 5th, 2017

Step 1: Enable Apache status and lock it down: Make sure mod_status is being loaded: grep -Rn mod_status /etc/httpd/*

Add support for the call just under the first DocumentRoot statement: vim /etc/httpd/conf/httpd.conf

Step 2. Prepare your environment: cpan YAML HTML::TableExtract Step 3: Create and run the status script: vim /root/astat

chmod 755 […]

How To Batch Search and Replace Multiple Files Using PERL

Author: , October 16th, 2014

Using PERL, we can easily do a search and replace across multiple files. perl -pi -w -e ‘s/SEARCH_FOR/REPLACE_WITH/g;’ FILE_LIST The following example will replace all occurrences of “hello” with “goodbye” inside files ending with .txt:

To handle special characters, use the hex value. For example, to convert MS web files that use control characters: […]

How To Force Getopt::Long To Be Case Sensitive in Perl

Author: , March 19th, 2014

How To Fix CPAN Error Undefined subroutine &IO::Uncompress::Base::readonly

Author: , December 26th, 2013

CPAN Error: Undefined subroutine &IO::Uncompress::Base::readonly called at /usr/lib/perl5/site_perl/5.8.8/IO/Uncompress/ Looks like CentOS update installs an older version of the Scalar::Util so that Perl could not load the module. Download the Scalar::Util module and manually install it:

To test: perl -MCPAN -e ‘shell’ For more information, visit the CPAN page. Original Post:;node_id=965635;replies=1

How to Patch CGI::Application::Plugin::ConfigAuto to Run Perl in Taint Mode

Author: , April 13th, 2012

I had to patch the distribution by adding the following variable into the code: $Config::Auto::Untaint = 1; Here is the fix on AWS Linux: vim /usr/local/share/perl5/CGI/Application/Plugin/ 141 sub cfg { 142 my $self = shift; 143 144 if (!$self->{__CFG}) { 145 require Config::Auto; 146 $Config::Auto::Untaint = 1; (ADD THIS NEW LINE HERE)

How To Determine Your Perl Module Version

Author: , April 12th, 2012

For example, to see the version for DBD::mysql, do this: perl -MDBD::mysql -we ‘print $DBD::mysql::VERSION;’