The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::LDAP::Class::MethodMaker - create methods for Net::LDAP::Class classes

SYNOPSIS

 package MyUser;
 use base qw( Net::LDAP::Class::User );
 use Net::LDAP::Class::MethodMaker (
    'scalar --get_set_init' => [qw( foo )],
    'related_objects'       => [qw( bars )],
 );
 
 __PACKAGE__->metadata->setup(
    base_dn             => 'dc=local',
    attributes          => [qw( foo )],
    unique_attributes   => [qw( foo )],
 );
 
 # must define a fetch_bars method
 sub fetch_bars {
    my $user = shift;
    
    # do something to get bar objects.
    
 }

 1;
 
 # elsewhere
 
 my $user = MyUser->new( foo => '1234' )->read or die;
 $user->foo;        # == $user->ldap_entry->get_value('foo');
 $user->foo(5678);  # == $user->ldap_entry->replace( foo => 5678 );
 $user->foo;        # returns '5678'
 
 my $bars       = $user->bars;  # == $user->fetch_bars;
 push(@$bars, 'new bar');
 $user->bars($bars);
 my $newbars    = $user->bars;  # != $user->fetch_bars;
 $user->clear_bars;
 $newbars       = $user->bars;  # == $user->fetch_bars;
 
 

DESCRIPTION

Net::LDAP::Class::MethodMaker is a subclass of Rose::Object::MakeMethods::Generic. It extends the base class with two new method types: related_objects and ldap_entry.

METHODS

The related_objects method type creates three methods for each name when using the 'get_set' (default) interface: name, fetch_name, and clear_name.

The fetch_ method must be defined by your class. It should return values from the LDAP server.

The name method is a get/set method. If nothing is set, it calls through to fetch_. Otherwise, if you have set something, it returns what you have set.

The clear_ method will delete any set value from the object and return it.

ldap_entry

The ldap_entry method type supports the 'get_set' interface only.

This method type negotiates the getting and setting of values in the delegate ldap_entry() object.

object_or_class_meta

Similar to the 'scalar --get-set-init' method type but may be called as a class method, in which case it will call through to the class metadata() object.

AUTHOR

Peter Karman, <karman at cpan.org>

BUGS

Please report any bugs or feature requests to bug-net-ldap-class at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-LDAP-Class. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Net::LDAP::Class

You can also look for information at:

ACKNOWLEDGEMENTS

The Minnesota Supercomputing Institute http://www.msi.umn.edu/ sponsored the development of this software.

COPYRIGHT

Copyright 2008 by the Regents of the University of Minnesota. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Net::LDAP::Class, Rose::Object::MakeMethods::Generic