use strict;
use warnings;
-our $VERSION = '0.01';
+our $VERSION = '0.02';
use base 'Class::MOP::Attribute';
-sub new {
+Perl6Attribute->meta->add_around_method_modifier('new' => sub {
+ my $cont = shift;
my ($class, $attribute_name, %options) = @_;
# extract the sigil and accessor name
$options{default} = sub { [] } if ($sigil eq '@');
$options{default} = sub { {} } if ($sigil eq '%');
- $class->SUPER::new($attribute_name, %options);
-}
+ $cont->($class, $attribute_name, %options);
+});
1;
package Foo;
- use Class::MOP 'meta';
-
Foo->meta->add_attribute(Perl6Attribute->new('$.foo'));
Foo->meta->add_attribute(Perl6Attribute->new('@.bar'));
Foo->meta->add_attribute(Perl6Attribute->new('%.baz'));
sub new {
my $class = shift;
- bless $class->meta->construct_instance() => $class;
+ $class->meta->new_object(@_);
}
=head1 DESCRIPTION
the reader though (if you do it, please send me a patch
though, and will update this).
-=head1 AUTHOR
+=head1 AUTHORS
Stevan Little E<lt>stevan@iinteractive.comE<gt>
+Yuval Kogman E<lt>nothingmuch@woobling.comE<gt>
+
=head1 COPYRIGHT AND LICENSE
-Copyright 2006 by Infinity Interactive, Inc.
+Copyright 2006-2008 by Infinity Interactive, Inc.
L<http://www.iinteractive.com>