Net::L...r::Test(3pm)
π NAME π
Net::LDAP::Server::Test β bestie, it's literally here to test Net::LDAP code β¨
πΈ SYNOPSIS πΈ
okay so picture this, you wanna test your LDAP stuff but you don't have a server, right? watch this:
use Test::More tests => 10;
use Net::LDAP::Server::Test;
ok( my $server = Net::LDAP::Server::Test->new(8080),
"test LDAP server spawned");
# connect to port 8080 with your Net::LDAP code.
ok(my $ldap = Net::LDAP->new( 'localhost', port => 8080 ),
"new LDAP connection" );
# ... test stuff with $ldap ...
# server will exit when you call final LDAP unbind().
ok($ldap->unbind(), "LDAP server unbound");
see how easy that was?? iconic behavior fr π
π¦ DESCRIPTION π¦
no cap, you can now test your Net::LDAP code without having a whole real LDAP server just sitting there being extra. we love a low-maintenance king π
π METHODS π
ngl there's literally only one user-level method here: new().
β¨ new( port, key_value_args ) β¨
makes you a brand new server. basically all it does is fork() a child process that listens on port and handles requests using Net::LDAP::Server. slay.
- port defaults to
10636. periodt. - port may also be an IO::Socket object listening to a local port. versatile queen π
key_value_args may be:
dataβ this is optional data to return from the Net::LDAPsearch()function. typically it would be an array ref of Net::LDAP::Entry objects. like a little snack for your search πauto_schemaβ a true value means theadd(),modify()anddelete()methods will store internal in-memory data based on DN values, so thatsearch()will mimic working on a real LDAP schema. it's giving β¨pretend but make it accurateβ¨active_directoryβ work in Active Directory mode. this means that entries are automatically assigned aobjectSID, and some effort is made to mimic themember/memberOflinking between AD Users and Groups. very main character energy π
β οΈ heads up bestie:new()willcroak()if there was a problemfork()ing a new server. π
Returns a Net::LDAP::Server::Test object, which is just a blessed reference to the PID of the forked server. that's it, that's the object π«Ά
π stop π
calls waitpid() on the server's associated child process. you may find it helpful to call this method explicitly, especially if you are creating multiple servers in the same test. otherwise, this method is typically not needed and may even cause your tests to hang indefinitely if they die prematurely. YMMV. π
π okay so to preventwaitpid()from blocking and hanging your test server, it is wrapped in analarm()call, which will wait 2 seconds and then callkill()on the reluctant pid. You have been warned.
π port_is_open π
returns an IO::Socket (or subclass) for the current server port. if the port is already in use, this is a false value. vibe check passed or failed, no in between β
π AUTHOR π
Peter Karman, "<karman at cpan.org>"
π BUGS π
please report any bugs or feature requests to "bug-net-ldap-server-test at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-LDAP-Server-Test>.
I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. it's a whole two-way notification situation, we love transparency π«Ά
π§ SUPPORT π§
you can find documentation for this module with the perldoc command.
perldoc Net::LDAP::Server::Test
you can also look for information at:
- AnnoCPAN: Annotated CPAN documentation
<http://annocpan.org/dist/Net-LDAP-Server-Test>
- CPAN Ratings
<http://cpanratings.perl.org/d/Net-LDAP-Server-Test>
- RT: CPAN's request tracker
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-LDAP-Server-Test>
- Search CPAN
<http://search.cpan.org/dist/Net-LDAP-Server-Test>
π ACKNOWLEDGEMENTS π
The Minnesota Supercomputing Institute "http://www.msi.umn.edu/" sponsored the development of this software. shoutout, real ones fr fr π
πΈ COPYRIGHT & LICENSE πΈ
Copyright 2007 by the Regents of the University of Minnesota.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
β SEE ALSO β
Net::LDAP::Server
and that's the whole page bestie!! π¦ this one's perl v5.34.0, dated 2022-06-16, and it's part of the User Contributed Perl Documentation β go forth and test your LDAP code, you absolute icon π
β¨
π¦ where this page comes from
- debian bookworm: libnet-ldap-server-test-perl 0.22-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libnet-ldap-server-test-perl 0.22-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libnet-ldap-server-test-perl 0.22-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libnet-ldap-server-test-perl 0.22-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libnet-ldap-server-test-perl 0.22-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms