Hi again, I've run into a problem that I can't quite understand.
I've created an HTML form that invokes a CGI script as form-action, that works well. I have a collection of LDAP related functions in a package that I use from the CGI script - this works to. ldapconnect() works, parseldapoutput() works ... One of the functions in the package outputs another form (the list of allowed attributes to search for) whose form-action is yet another script that then uses more of the first scripts functions to (or so I thought) do an LDAP search on the fields selected from the form. When I invoke search_it from script2 I get the following error in my apache log: Can't call method "search" on an undefined value at ldap2csv.pl line 118, <DATA> line 225. 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( 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"; } } } } } Where to look, what (else) to try? Cheers, Andrej