Friday 24 February 2012

Can't locate package Exporter for @PHP::Interpreter::ISA

The last time I caught a culprit was a while ago, and so when I saw this exception, did not hessitate to post the solution right away to fill in the gap. I was performing sys_log analysis this afternoon with Perl and decided to use PHP::Interpreter module to connect to POD for data persistence. ..fired first line syntax to PHP::Interpreter:
my $php_ = PHP::Interpreter->new;
then suddenly, Gotcha! the culprit below.
Can't locate package Exporter for @PHP::Interpreter::ISA at /usr/local/lib/perl/5.10.1/PHP/Interpreter.pm line 35.
Can't locate package Exporter for @PHP::Interpreter::ISA at /usr/lib/perl/5.10/DynaLoader.pm line 193.
Although I have to be honest, it still does the interpretation, I thought! gotta shut this up before future issues. And so got my eyes peeled and poked through the Interpreter.pm module for clues.

Solution
The solution was pretty simple if not obvious at first hand. Add below line of syntax to the Interpreter.pm module.
use Exporter "import";
right after the the line of syntax
require DynaLoader;
Perl's Exporter module allows modules to "export" identifiers (i.e., variable and subroutine names) into the calling program's namespace. See Exporter for more infomation on importing modules to perl function namespace.

No comments:

Post a Comment