[rt-users] Problem with update dept from ldap action in RT Essentials

Mike Patterson mikep at uclink.berkeley.edu
Wed Jan 4 19:18:20 EST 2006


RT folks,

I'm trying to use the sample scrip on page 81 of RT Essentials that 
updates custom field "Department" based on information retrieved from LDAP.
Condition: OnCreate, Action: User Defined (pasted code into action prep 
code - see below), Template: Blank

I'm not sure how to debug this... The "base dn" is the same as we use 
for our email clients ldap lookups.  I have Net::LDAP installed from 
CPAN... the rt.log file says:
[Wed Jan  4 20:10:40 2006] [error]: Scrip 154 Prepare failed: Can't 
locate object method "new" via package "Net::LDAP" (perhaps you forgot 
to load "Net::LDAP"?) at (eval 2124) line 3.

How would I go about "loading" Net::LDAP?

I pasted the custom action and full rt.log error message below.

Thanks in advance for any tips.

Mike

My build (mostly from ports)
RT 3.2.2, Perl v5.8.4 under freebsd, Apache v1.27, FreeBSD 4.11, 
mod_perl v1.29


------------
my $email = ($self->TicketObj->RequestorAddresses)[0];
      my $ldap = Net::LDAP->new( 'directory.unex.berkeley.edu' );
   $ldap->bind;
      my $msg = $ldap->search( base   => 'dc=unex,dc=berkeley,dc=edu',
                            filter => "(email=$email)",
                          );
      my $entry = $msg->entry(0);
      my $dept = $entry->get_value('ou');
      my $cf = RT::CustomField->new( $RT::SystemUser );
   $cf->LoadByName( Name => 'Department' );
      $self->TicketObj->AddCustomFieldValue( Field => $cf, Value => 
$dept );
      return 1;
--------------

It doesn't seem to work and I keep getting the same message in my rt.log 
file:
------------------------------------
[Wed Jan  4 20:10:40 2006] [error]: Scrip 154 Prepare failed: Can't 
locate object method "new" via package "Net::LDAP" (perhaps you forgot 
to load "Net::LDAP"?) at (eval 2124) line 3.

Stack:
 [(eval 2124):3]
 [/usr/local/rt3/lib/RT/ScripAction_Overlay.pm:217]
 [/usr/local/rt3/lib/RT/Scrip_Overlay.pm:468]
 [/usr/local/rt3/lib/RT/Scrips_Overlay.pm:232]
 [/usr/local/rt3/lib/RT/Transaction_Overlay.pm:146]
 [/usr/local/rt3/lib/RT/Ticket_Overlay.pm:3707]
 [/usr/local/rt3/lib/RT/Ticket_Overlay.pm:710]
 [/usr/local/rt3/lib/RT/Interface/Web.pm:340]
 [/usr/local/rt3/share/html/Ticket/Display.html:100]
 [/usr/local/rt3/share/html/Ticket/Create.html:279]
 [/usr/local/rt3/share/html/autohandler:221]
(/usr/local/rt3/lib/RT/Action/UserDefined.pm:65)
------------------------------------

-- 
Mike Patterson
Systems Manager
UC Berkeley Extension




More information about the rt-users mailing list