17 October 2011

RHEL5 and Perl CPAN: PDF::API2 error 'Can't call method "infilt" on an undefined value'

We updated a client's RHEL5 server this weekend and they started getting issues with the Perl CPAN module 'PDF::API2', specifically:

Can't call method "infilt" on an undefined value at /usr/lib/perl5/site_perl/5.8.5/PDF/API2/Util.pm line 667

Some results said to remove and reinstall Perl and all modules, but that seemed extreme. Since CPAN modules are outside of the general GNU/Linux package management, they don't have the normal bugfixes and compatibility checks that an official distro package would have. But, it also means that we probably don't need to look at the Package Manager for a fix.

I started with a downgrade to that Perl package, but I am not sure this was needed or not:

root@server:# yum downgrade perl-5.8.8

Loaded plugins: rhnplugin, security

Setting up Downgrade Process

Resolving Dependencies

--> Running transaction check

---> Package perl.x86_64 4:5.8.8-32.el5_5.1 set to be updated

---> Package perl.x86_64 4:5.8.8-32.el5_5.2 set to be erased

That still gave the error Can't call method "infilt"... so I looked into rebuilding the PDF::API2 module:

root@server:# cpan -fi PDF::API2

That had issues with the ExtUtils::MakeMaker CPAN extension which had its own issues... this seemed like a dependency issue in Perl/CPAN. I looked into the CPAN man page and saw that -r will recompile a module. I tried that against the PDF::API2 and that seems to have worked!

root@server:# cpan -r PDF::API2

The MakePDF command no longer gives errors and the customer reports that things are again working:

root@server:# MakePDF -t /var/pdftemp/template.pdf -s /var/pdfinvoice/12340.pdf -i /var/emailtext/12340.txt -l 25 -m 30

root@server:#

0 comments: