package Moose::Meta::Attribute::Native;
-our $VERSION = '1.15';
-$VERSION = eval $VERSION;
-our $AUTHORITY = 'cpan:STEVAN';
+use Class::Load qw(load_class);
my @trait_names = qw(Bool Counter Number String Array Hash Code);
);
if ($meta->find_method_by_name('register_implementation')) {
my $class = $meta->name->register_implementation;
- Moose->throw_error(
+ Moose::Util::throw(
"An implementation for $trait_name already exists " .
"(found '$class' when trying to register '$trait_class')"
);
$meta->add_method(register_implementation => sub {
# resolve_metatrait_alias will load classes anyway, but throws away
# their error message; we WANT to die if there's a problem
- Class::MOP::load_class($trait_class);
+ load_class($trait_class);
return $trait_class;
});
}
1;
+# ABSTRACT: Delegate to native Perl types
+
__END__
=pod
-=head1 NAME
-
-Moose::Meta::Attribute::Native - Delegate to native Perl types
-
=head1 SYNOPSIS
package MyClass;
=head1 DESCRIPTION
Native delegations allow you to delegate to native Perl data
-structure as if they were objects. For example, in the L</SYNOPSIS> you can
+structures as if they were objects. For example, in the L</SYNOPSIS> you can
see a hash reference being treated as if it has methods named C<exists()>,
C<keys()>, C<get()>, and C<set()>.
example, to use this with a Hash you must specify that your attribute is some
sort of C<HashRef>.
-If you I<don't> specify a type, each trait has a default type it will use.
-
=head2 handles
This is just like any other delegation, but only a hash reference is allowed
Some traits provide a default C<is> for historical reasons. This behavior is
deprecated, and you are strongly encouraged to provide a value. If you don't
-plan to read and write the attribute value directly, you can set C<< is =>
-'bare' >> to prevent standard accessor generation.
+plan to read and write the attribute value directly, not passing the C<is>
+option will prevent standard accessor generation.
=head2 default or builder
See L<Moose/BUGS> for details on reporting bugs.
-=head1 AUTHOR
-
-Stevan Little E<lt>stevan@iinteractive.comE<gt>
-
-B<with contributions from:>
-
-Robert (rlb3) Boone
-
-Paul (frodwith) Driver
-
-Shawn (Sartak) Moore
-
-Chris (perigrin) Prather
-
-Robert (phaylon) Sedlacek
-
-Tom (dec) Lanyon
-
-Yuval Kogman
-
-Jason May
-
-Cory (gphat) Watson
-
-Florian (rafl) Ragwitz
-
-Evan Carroll
-
-Jesse (doy) Luehrs
-
-Jay Hannah
-
-Robert Buels
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2007-2009 by Infinity Interactive, Inc.
-
-L<http://www.iinteractive.com>
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
=cut