Hi, On Monday, 18. September 2006 04:26, Andrej Ricnik-Bay wrote: > Can't call method "search" on an undefined value at ldap2csv.pl line > 118, <DATA> line 225.
It's in line 118, where the Perl is told to perform the search() method on something that is undefined nistead of an object of a class that supports a search() method. > I can't for the life of me figure out which value it's complaining about as > uninitialised ... I've verified with a print that the parameter passed is > valid and has the list of attributes in it; everything else is constant. > from script2: > &ldapcsv::print_header(); > > read( STDIN, $data, $ENV{"CONTENT_LENGTH"}); > @pairs = split( "&", $data); > #print "Anything here at all? $data <BR>\n"; > foreach $pair (@pairs) { > $name=""; $value=""; > # print "<BR>SPACER<BR> $#pairs <BR>\n"; > $pair =~ tr/+/ /; > $pair =~ s/%(..)/pack("C", hex($1))/eg; > $pair =~ m/(\w+)(?:=)?(.+)/ ; > if( defined $2 && $2 ne "=" ) { > $name=$1; > $value=$2; > chomp $name; > chomp $value; > if ( $name =~ /Attributes/ && defined $query ){ > $query .= ", '".$value."'" > } else { > $query = "'".$value."'" > } > } > } > print "<BR>Final: $query <BR>\n"; > > &ldapcsv::search_it( $query ); > > > script1: > package ldapcsv; > use strict; > use Net::LDAP; > use Net::LDAP::Entry; > use Net::LDAP::Schema; > . > . > . > sub search_it { > my ( $param ) = @_ ; > print "<BR>In search_it: $param <BR>\n"; > $mesg = $ldap->search( I guess here is the problem. Did you define $ldap in this package ? > base => 'ou=people,ou=users,o=ORG', > filter => '(cn=*)', > scope => 'sub', > attrs => [ "$param" ], > timelimit => 90 > ); > if ( $mesg->code == 0 ) { > my @entry = $mesg->entries; > if (@entry) { > foreach my $entr (@entry) { > my $attr; > foreach $attr ( sort $entr->attributes ) { > print " $attr : ", $entr->get_value($attr), "\n"; > } > } > } > } > } > Hope it helps Peter -- Peter Marschall [EMAIL PROTECTED]