2 package Moose::Meta::Method::Delegation;
8 use Scalar::Util 'blessed', 'weaken';
10 our $VERSION = '0.57';
11 $VERSION = eval $VERSION;
12 our $AUTHORITY = 'cpan:STEVAN';
14 use base 'Moose::Meta::Method';
21 (exists $options{attribute})
22 || confess "You must supply an attribute to construct with";
24 (blessed($options{attribute}) && $options{attribute}->isa('Moose::Meta::Attribute'))
25 || confess "You must supply an attribute which is a 'Moose::Meta::Attribute' instance";
27 ($options{package_name} && $options{name})
28 || confess "You must supply the package_name and name parameters $Class::MOP::Method::UPGRADE_ERROR_TEXT";
30 my $self = $class->_new(\%options);
32 weaken($self->{'attribute'});
39 my $options = @_ == 1 ? $_[0] : {@_};
41 return bless $options, $class;
44 sub associated_attribute { (shift)->{'attribute'} }
54 Moose::Meta::Method::Delegation - A Moose Method metaclass for delegation methods
58 This is a subclass of L<Moose::Meta::Method> for delegation
65 =item B<new (%options)>
67 This creates the method based on the criteria in C<%options>,
74 This must be an instance of C<Moose::Meta::Attribute> which this
75 accessor is being generated for. This paramter is B<required>.
79 =item B<associated_attribute>
81 Returns the attribute associated with this method.
87 All complex software has bugs lurking in it, and this module is no
88 exception. If you find a bug please either email me, or add the bug
93 Dave Rolsky E<lt>autarch@urth.orgE<gt>
95 =head1 COPYRIGHT AND LICENSE
97 Copyright 2008 by Infinity Interactive, Inc.
99 L<http://www.iinteractive.com>
101 This library is free software; you can redistribute it and/or modify
102 it under the same terms as Perl itself.