Q: Seeking guidance on perl module loading in RT

Greetings,

I have a custom build perl script that I adapted from the one in 

the O’reily “RT Essentials” book pg. 81, that queries a LDAP database for
lots of information, parses it, and populates lots of custom fields in RT.
While I am a beginner perl scripter, I have tested by perl script
on the command line (substituting the RT ins and outs because it’s not
running inside RT) and it all works as expected.
However, once plugged into RT as a “Custom action preparation
code:” (Configuration/Global/Scripts), I receive the following error when
the script is triggered:

Jun 21 13:23:45 rt RT: Scrip 16 Prepare failed: Can’t locate object method
"new" via package “Net::LDAP” (perhaps you forgot to load “Net::LDAP”?) at
(eval 332) line 11. Stack: [(eval 332):11]
[/usr/local/rt3/lib/RT/ScripAction_Overlay.pm:233]
[/usr/local/rt3/lib/RT/Scrip_Overlay.pm:478]
[/usr/local/rt3/lib/RT/Scrips_Overlay.pm:236]
[/usr/local/rt3/lib/RT/Transaction_Overlay.pm:162]
[/usr/local/rt3/lib/RT/Record.pm:1438]
[/usr/local/rt3/lib/RT/Ticket_Overlay.pm:720]
[/usr/local/rt3/lib/RT/Interface/Email.pm:765]
[/usr/local/rt3/share/html/REST/1.0/NoAuth/mail-gateway:58]
(/usr/local/rt3/lib/RT/Action/UserDefined.pm:65)

As I interpret this, RT can’t find Net::LDAP. However, Net::LDAP is
installed according to CPAN, and again, when run as a command line script,
the script has no problems finding it. Do I need to tell RT where to find
the perl modules somehow? Does this have to be specified at compile with
a “require Net::LDAP” tag or some such?

The mailing archive has a similar issue by “mtaylor at real” on Debian (I
am using FreeBSD 5.5), and apparently his issue was resolved by adding
LDAP configuration information to his RTSiteConfig.pm. I have added this
information my RTSiteConfig.pm and have not seen any changes in my error.
http://www.gossamer-threads.com/lists/rt/users/39722?search_string=%2B%26quot%3BCan’t%20locate%20object%20method%26quot%3B%20%2B%26quot%3Bperhaps%20you%20forgot%20to%20load%26quot%3B%20%2B%26quot%3BNet%3A%3ALDAP%26quot%3B;#39722

Google has not turned up much useful info (except for the RT mailing
archive issue).

I am out of ideas at this point, and would appreciate it if someone could
point me in the right direction. Thanks for any assistance in advance.

Thanks,

John H. Nyhuis
Sr. Computer Specialist
Dept. of Pediatrics
HS RR349B, Box 356320
University of Washington
Desk: (206)-685-3884
cabal@u.washington.edu

I apologize for spamming folks a second time.

I also checked the perms on the ldap.pm module and set them to 755 just in
case that was the issue. My error did not change.

Thanks,

John N.---------- Forwarded message ----------
Date: Wed, 21 Jun 2006 14:30:03 -0700 (PDT)
From: John H. Nyhuis cabal@u.washington.edu
To: rt-users@lists.bestpractical.com
Subject: Q: Seeking guidance on perl module loading in RT

Greetings,

I have a custom build perl script that I adapted from the one in the 

O’reily “RT Essentials” book pg. 81, that queries a LDAP database for lots of
information, parses it, and populates lots of custom fields in RT.
While I am a beginner perl scripter, I have tested by perl script on
the command line (substituting the RT ins and outs because it’s not running
inside RT) and it all works as expected.
However, once plugged into RT as a “Custom action preparation code:”
(Configuration/Global/Scripts), I receive the following error when the script
is triggered:

Jun 21 13:23:45 rt RT: Scrip 16 Prepare failed: Can’t locate object method
"new" via package “Net::LDAP” (perhaps you forgot to load “Net::LDAP”?) at
(eval 332) line 11. Stack: [(eval 332):11]
[/usr/local/rt3/lib/RT/ScripAction_Overlay.pm:233]
[/usr/local/rt3/lib/RT/Scrip_Overlay.pm:478]
[/usr/local/rt3/lib/RT/Scrips_Overlay.pm:236]
[/usr/local/rt3/lib/RT/Transaction_Overlay.pm:162]
[/usr/local/rt3/lib/RT/Record.pm:1438]
[/usr/local/rt3/lib/RT/Ticket_Overlay.pm:720]
[/usr/local/rt3/lib/RT/Interface/Email.pm:765]
[/usr/local/rt3/share/html/REST/1.0/NoAuth/mail-gateway:58]
(/usr/local/rt3/lib/RT/Action/UserDefined.pm:65)

As I interpret this, RT can’t find Net::LDAP. However, Net::LDAP is installed
according to CPAN, and again, when run as a command line script, the script has
no problems finding it. Do I need to tell RT where to find the perl modules
somehow? Does this have to be specified at compile with a "require Net::LDAP"
tag or some such?

The mailing archive has a similar issue by “mtaylor at real” on Debian (I am
using FreeBSD 5.5), and apparently his issue was resolved by adding LDAP
configuration information to his RTSiteConfig.pm. I have added this
information my RTSiteConfig.pm and have not seen any changes in my error.
http://www.gossamer-threads.com/lists/rt/users/39722?search_string=%2B%26quot%3BCan’t%20locate%20object%20method%26quot%3B%20%2B%26quot%3Bperhaps%20you%20forgot%20to%20load%26quot%3B%20%2B%26quot%3BNet%3A%3ALDAP%26quot%3B;#39722

Google has not turned up much useful info (except for the RT mailing archive
issue).

I am out of ideas at this point, and would appreciate it if someone could point
me in the right direction. Thanks for any assistance in advance.

Thanks,

John H. Nyhuis
Sr. Computer Specialist
Dept. of Pediatrics
HS RR349B, Box 356320
University of Washington
Desk: (206)-685-3884
cabal@u.washington.edu