LPM: a problem with modularity using Net::LDAP

Joe Hourcle oneiros at dcr.net
Sun Nov 5 22:16:03 CST 2000



On Thu, 2 Nov 2000, Frank Price wrote:

> Since no one has answered, I'll take a shot.
> 
> On Thu, Oct 26, 2000 at 02:37:33PM -0400, Joe Hourcle wrote:
> > 
> > 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.
> 
> Where is search()?  The second module?  And you are creating it from
> within the first module, or from the actual script?

Correct.  For clarity's sake, I'll refer to them as the main program,
gwldap, and Net::LDAP.

the main program is using gwldap, and calling a function which returns a
Net::LDAP object.  The main program is then calling search() on the
object.


> Do you have a 'use second_module' in the first one?  Or are you
> 'use'ing both from the actual script?  

Hmm...there'sa thought...I'm only 'use'ing Net::LDAP in gwldap, not in the
main program.  It might be that the object gets dropped when the program
sees an object blessed into a class that it doesn't know about directly.

[I'd normally check it right this second, but it's been a long day, so
I'll try it first thing when I get to work]

> Lastly, might be worth starting the debugger to find out just what's
> happening.

And it's times like this when I really wish I had been to the meetings
when the debugger was being discussed.  If all else fails, I guess it's
probably worth my time to try to learn it.

-Joe




More information about the Lexington-pm mailing list