use strict;
use warnings;
-our $VERSION = '0.13';
+our $VERSION = '0.17';
use Scalar::Util 'blessed', 'reftype';
use Carp 'confess';
subtype $class
=> as 'Object'
=> where { $_->isa($class) }
+ => optimize_as { blessed($_[0]) && $_[0]->isa($class) }
unless find_type_constraint($class);
my $meta;
},
# NOTE:
- # this is experimental for now ...
- self => sub {
- return subname 'Moose::self' => sub {};
- },
- method => sub {
- my $class = $CALLER;
- return subname 'Moose::method' => sub {
- my ($name, $method) = @_;
- $class->meta->add_method($name, sub {
- my $self = shift;
- no strict 'refs';
- no warnings 'redefine';
- local *{$class->meta->name . '::self'} = sub { $self };
- $method->(@_);
- });
- };
- },
+ # this is experimental, but I am not
+ # happy with it. If you want to try
+ # it, you will have to uncomment it
+ # yourself.
+ # There is a really good chance that
+ # this will be deprecated, dont get
+ # too attached
+ # self => sub {
+ # return subname 'Moose::self' => sub {};
+ # },
+ # method => sub {
+ # my $class = $CALLER;
+ # return subname 'Moose::method' => sub {
+ # my ($name, $method) = @_;
+ # $class->meta->add_method($name, sub {
+ # my $self = shift;
+ # no strict 'refs';
+ # no warnings 'redefine';
+ # local *{$class->meta->name . '::self'} = sub { $self };
+ # $method->(@_);
+ # });
+ # };
+ # },
confess => sub {
return \&Carp::confess;
delete ${$class . '::'}{$name};
}
}
-
- # return a true value
- # so that it can be used
- # as a module end
- 1;
}
}
are still subject to change (although not without serious thought
given to it).
-For more details, please refer to the L<FUTURE PLANS> section of
-this document.
-
=head1 DESCRIPTION
Moose is an extension of the Perl 5 object system.