LPM: a problem with modularity using Net::LDAP

Joe Hourcle oneiros at dcr.net
Thu Oct 26 13:37:33 CDT 2000


I'm attempting to make a module which essentially returns an object from a
different module.


Basically, the plan is, that so I don't have to keep track of multiple
passwords in multiple places, I'm using a module which contains
information which I need for conecting to our LDAP server, but which will
return a Net::LDAP object.

[and I can pass it arguments so that it'll bind as admin, read-only to
everything, as a standard user or anonymously, to either the main server, 
or to one of the two development servers]



When I return a Net::LDAP object from this module, however, I get:

	Can't call method "search" on an undefined value at
	./update_ldap.pl line 156.


If I return a reference to the object, and then dereference the returned
value, I get the same thing.

So, I was thinking, maybe it's a problem with the scope of the variable.
[even though it's technically just a reference], so I changed it so the
temporary variable that I was storing the object in while I did the bind
was a package variable, and so, wouldn't just be valid in the confines of
that function.

But of course, I got the same result.


Has anyone ever done anything similar, and know what the correct syntax is
to pass an object from an unrelated module?



-----
Joe Hourcle




More information about the Lexington-pm mailing list