|
NAMENet::LDAP::Server::Test - test Net::LDAP codeSYNOPSISuse 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"); DESCRIPTIONNow you can test your Net::LDAP code without having a real LDAP server available.METHODSOnly one user-level method is implemented: new().new( port, key_value_args )Create a new server. Basically this just fork()s a child process listing on port and handling requests using Net::LDAP::Server.port defaults to 10636. port may be an IO::Socket object listening to a local port. key_value_args may be:
new() will croak() if there was a problem fork()ing a new server. Returns a Net::LDAP::Server::Test object, which is just a blessed reference to the PID of the forked server. stopCalls 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.To prevent waitpid() from blocking and hanging your test server, it is wrapped in an alarm() call, which will wait 2 seconds and then call kill() on the reluctant pid. You have been warned. port_is_openReturns an IO::Socket (or subclass) for the current server port. If the port is already in use, this is a false value.AUTHORPeter Karman, "<karman at cpan.org>"BUGSPlease 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.SUPPORTYou can find documentation for this module with the perldoc command.perldoc Net::LDAP::Server::Test You can also look for information at:
ACKNOWLEDGEMENTSThe Minnesota Supercomputing Institute "http://www.msi.umn.edu/" sponsored the development of this software.COPYRIGHT & LICENSECopyright 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 ALSONet::LDAP::Server
Visit the GSP FreeBSD Man Page Interface. |