Update changes for this branch
[gitmo/Moose.git] / lib / Moose / Meta / Method / Delegation.pm
CommitLineData
a05f85c1 1
2package Moose::Meta::Method::Delegation;
3
4use strict;
5use warnings;
6
7use Carp 'confess';
8use Scalar::Util 'blessed', 'weaken';
9
10our $VERSION = '0.57';
11$VERSION = eval $VERSION;
12our $AUTHORITY = 'cpan:STEVAN';
13
14use base 'Moose::Meta::Method';
15
16
17sub new {
18 my $class = shift;
19 my %options = @_;
20
21 (exists $options{attribute})
22 || confess "You must supply an attribute to construct with";
23
24 (blessed($options{attribute}) && $options{attribute}->isa('Class::MOP::Attribute'))
25 || confess "You must supply an attribute which is a 'Class::MOP::Attribute' instance";
26
27 ($options{package_name} && $options{name})
28 || confess "You must supply the package_name and name parameters $Class::MOP::Method::UPGRADE_ERROR_TEXT";
29
30 my $self = $class->_new(\%options);
31
32 weaken($self->{'attribute'});
33
34 return $self;
35}
36
371;