Begin forwarded message:
From: "D.Kreft" <[EMAIL PROTECTED]>
Date: 10 December 2003 18:44:25 GMT
To: Graham Barr <[EMAIL PROTECTED]>
Subject: Net::LDAP data accessors
Message-Id: <[EMAIL PROTECTED]>


Hey Graham,

One tiny suggestion for your next release of Net::LDAP...

Could you add some data accessors to the API? Currently, one must violate
the encapsulation of an object to get the hostname from the object when
reporting errors, for example:


if ( [EMAIL PROTECTED] ) {
# HACK ALERT!
# I know, I know...violating an objects encapsulation is bad.
# But the authors of Net::LDAP didn't include an accessor
# for this data into verison 0.2701, so I am left with no other
# choice. At least I'm providing for a sensible default in case
# the authors/maintainers decide to change things around under the
# covers.
my $host = $ldap->{'net_ldap_host'} || 'Server';


        my $error = sprintf("%s returned code %s (\"%s\"), "
                            . "but no urls could be found",
                            $host,
                            $code,
                            $message->error() || '');

        Carp::croak($error);
    }

In general, it's not possible to know what host a particular instance of
Net::LDAP is tied to without reaching under the covers and fondling the data
(which I would rather not do), espeically when the object is created in one
place and then passed to another subroutine/method.


Accessors for other things like port number, binddn and other stuff would
also be very useful.


Thanks, in advance, for your consideration. :-)

__END__

Dan Kreft
Software Engineer <><
Infrastructure Tools & Automation
Amazon.com, Inc.


If corn oil is made from corn, and vegetable oil is made from vegetables,
then what is baby oil made from?





Reply via email to