Can’t Locate JavaScript/DataFormValidator.pm In @INC

The error detailed below is from the Apache error logs. The error displayed in the Apache error log after the first attempt to visit monarch.cgi for the first time. I had already installed the JavaScript::DataFormValidatorĀ Perl module but after initially installing the JavaScript::DataFormValidator Perl module I also installed Perl 5.10 in a different location than the Perl 5.8.8 that was already installed on the CentOS Linux server. Below I describe the error, how to install the JavaScript::DataFormValidator Perl module using the CPAN shell, and some minor modifications I made to the Monarch CGI scripts to use Perl 5.10 instead of Perl 5.8.8.

Apache Error Log Entries Displayed After Visiting Monarch.cgi For The First Time:

[Wed Jan 27 10:23:06 2010] [error] [client 192.168.1.50] Can't locate JavaScript/DataFormValidator.pm in @INC (@INC contains: /usr/share/nagios/monarch/lib /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/share/nagios/monarch/lib/MonarchValidation.pm line 21.
[Wed Jan 27 10:23:06 2010] [error] [client 192.168.1.50] BEGIN failed--compilation aborted at /usr/share/nagios/monarch/lib/MonarchValidation.pm line 21.
[Wed Jan 27 10:23:06 2010] [error] [client 192.168.1.50] Compilation failed in require at /usr/share/nagios/cgi-bin/monarch.cgi line 34.
[Wed Jan 27 10:23:06 2010] [error] [client 192.168.1.50] BEGIN failed--compilation aborted at /usr/share/nagios/cgi-bin/monarch.cgi line 34.
[Wed Jan 27 10:23:06 2010] [error] [client 192.168.1.50] Premature end of script headers: monarch.cgi

First make sure that the Perl module that is being complained about is actually installed. Launch the Perl CPAN shell and attempt to install the Perl JavaScript::DataFormValidator module.

Install JavaScript::DataFormValidator From The CPAN Shell:

[root@server ~]# perl -MCPAN -e shell
cpan> install JavaScript::DataFormValidator

Once installed this should resolve your issue that is displayed in the Apache error logs The other issue I resolved was the fact that Monarch was still attempting to use the Perl 5.8.8 installation instead of the Perl 5.10 installation. Perl 5.8.8 was installed in /usr/bin while Perl 5.10 was installed in /usr/local/bin. To change the version of Perl used by the Monarch CGI scripts you can modify the beginning line of each CGI script as explained below.

Default Monarch CGI/Perl Script Language Designation Line:

#!/usr/bin/perl --

Modified Monarch CGI/Perl Script Language Designation Line:

#!/usr/local/bin/perl --

Notice the only difference is the “local” directory addition in the modified version. Below will explain more the difference between the two lines by running the version output for each.

Example Perl Version output Using /usr/bin/perl:

[root@server ~]# /usr/bin/perl -v

This is perl, v5.8.8 built for i386-linux-thread-multi

Copyright 1987-2006, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
[root@server ~]#

Example Perl Version output Using /usr/local/bin/perl:

[root@server ~]# /usr/local/bin/perl -v
This is perl, v5.10.1 (*) built for i686-linux

Copyright 1987-2009, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
[root@server ~]#

Now you can see that by changing the first line in each of the Monarch CGI files that in this case we switched the version of Perl that the CGI files will use to execue their code from Perl 5.8.8 to Perl 5.10.

Learning Perl, 5th Edition (Paperback)

By (author): Randal Schwartz, Tom Phoenix, brian d foy


List Price: $39.99 USD
New From: $29.99 USD In Stock
Used from: $6.87 USD In Stock


List Price: $59.95 USD
New From: $10.53 USD In Stock
Used from: $7.37 USD In Stock

Share