[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-ldap-dev
Subject:    Re: Can't locate object method "new" via package
From:       Graham Barr <gbarr () pobox ! com>
Date:       2003-08-02 19:27:17
[Download RAW message or body]


On Friday, Aug 1, 2003, at 07:06 US/Pacific, Radhakrishnan, Rajagopal 
wrote:

> Hello,
> I'm using  Net::LDAP to search and add ldap entry. the search works 
> fine,
> but "add" gives below error. any help appreciated. Thanks. -Raj
>
>
> compile:
> ========
> perl -Ic:/perl/lib/Convert-ASN1-0.17/lib/ 
> -Ic:/perl/lib/perl-ldap-0.29/lib/
> add_ldap_org.pl
>
> error:
> =====
> Can't locate object method "new" via package "Net::LDAP::Add" (perhaps 
> you
> forgo
> t to load "Net::LDAP::Add"?) at 
> c:/perl/lib/perl-ldap-0.29/lib//Net/LDAP.pm
> line
>  227, <DATA> line 185.

Thats really odd because Net/LDAP/Message.pm has

  @Net::LDAP::Add = qw(Net::LDAP::Message);

and Net::LDAP::Message is included by LDAP.pm

Graham.

>
> code:
> =====
>
> #!/usr/bin/perl
> use Net::LDAP;
> #use Net::LDAP qw(:all);                      # use for all code
>   $directoryURL       = "ecat1.xxx11.com";
>
>   $ldap = Net::LDAP->new($directoryURL) # as struct
>        or die "$@";
>
> my $DNbranch = "ou=bailiwick, o=mycompany, c=mycountry";
>
> my $CreateArray = [
>              objectClass => ["top","person","organizationalPerson"],
>                       cn => "Jane User",
>                      uid => "0000001",
>                       sn => "User",
>                     mail => " JaneUser@mycompany.com
> <mailto:JaneUser@mycompany.com> "
>                 ];
> my $NewDN =  "@$CreateArray[2]=".
>                   "@$CreateArray[3]+".
>                   "@$CreateArray[4]=".
>                   "@$CreateArray[5],".
>                   $DNbranch;
> LDAPentryCreate($ldap,$NewDN,$CreateArray);
>
>
> sub LDAPentryCreate
> {
>      my ($ldap,$dn,$whatToCreate) = @_ ;
>      my $result = $ldap->add( $dn, attrs => [  @$whatToCreate ] );
>      return ($result );
> }
>
>
> Thanks,
> Raj Radhakrishnan
> Systems Analyst
> 717-810-2830
> mailto:rrad@tycoelectronics.com <mailto:rrad@tycoelectronics.com>
>
>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic