1# Copyright (c) 2000-2004 Graham Barr <gbarr@pobox.com>. All rights reserved. 2# This program is free software; you can redistribute it and/or 3# modify it under the same terms as Perl itself. 4 5package Net::LDAP::Extra; 6 7use strict; 8use vars qw($VERSION); 9 10require Net::LDAP; 11require Carp; 12 13$VERSION = "0.01"; 14 15sub import { 16 shift; 17 local $SIG{__DIE__} = \&Carp::croak; 18 foreach (@_) { 19 my $file = "Net/LDAP/Extra/$_.pm"; 20 next if exists $INC{$file}; 21 require $file; 22 "Net::LDAP::Extra::$_"->import; 23 } 24} 25 261; 27 28__END__ 29 30 31=head1 NAME 32 33Net::LDAP::Extra -- Load extra Net::LDAP methods 34 35=head1 SYNOPSIS 36 37 use Net::LDAP::Extra qw(my_extn); 38 39 $ldap = Net::LDAP->new( ... ); 40 41 $ldap->my_extn( ... ); 42 43=head1 DESCRIPTION 44 45C<Net::LDAP::Extra> allows extra methods to be added to Net::LDAP. 46Normally such methods would be added by sub-classing Net::LDAP, but this 47proves to get messy as different people write different additions and 48others want to use multiple of these sub-classes. Users end up having 49to create sub-classes of their own which inherit from all the extension 50sub-classes just so they can get all the features. 51 52C<Net::LDAP::Extra> allows methods to be added directly to 53all Net::LDAP objects. This can be done by creating a class 54C<Net::LDAP::Extra::name> which exports functions. A 55C<use Net::LDAP::Extra qw(name)> will then make these functions avaliable 56as a methods on all C<Net::LDAP> objects. 57 58Care should be taken when choosing names for the functions to export 59to ensure that they do not clash with others. 60 61=cut 62 63