Class::MOP::Method::Accessor - Method Meta Object for accessors
use Class::MOP::Method::Accessor; my $reader = Class::MOP::Method::Accessor->new( attribute => $attribute, is_inline => 1, accessor_type => 'reader', ); $reader->body->($instance); # call the reader method
This is a Class::MOP::Method subclass which is used interally by Class::MOP::Attribute to generate accessor code. It can handle generation of readers, writers, predicate and clearer methods, both as closures and as more optimized inline methods.
Class::MOP::Method
Class::MOP::Attribute
This creates the method based on the criteria in %options, these options are:
%options
This must be an instance of Class::MOP::Attribute which this accessor is being generated for. This paramter is required.
This is a string from the following set; reader, writer, accessor, predicate or clearer. This is used to determine which type of method is to be generated.
This is a boolean to indicate if the method should be generated as a closure, or as a more optimized inline version.
This returns the accessor type which was passed into new.
new
This returns the boolean which was passed into new.
This returns the attribute instance which was passed into new.
This will actually generate the method based on the specified criteria passed to the constructor.
These methods will generate appropriate code references for the various types of accessors which are supported by Class::MOP::Attribute. The names pretty much explain it all.
Stevan Little <stevan@iinteractive.com>
Copyright 2006-2008 by Infinity Interactive, Inc.
http://www.iinteractive.com
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Class::MOP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::MOP
CPAN shell
perl -MCPAN -e shell install Class::MOP
For more information on module installation, please visit the detailed CPAN module installation guide.