use Mouse::Meta::Method::Constructor;
use Mouse::Meta::Method::Destructor;
use Scalar::Util qw/blessed weaken/;
-use Mouse::Util qw/get_linear_isa version authority identifier get_code_info/;
+use Mouse::Util qw/get_linear_isa/;
use Carp 'confess';
use base qw(Mouse::Meta::Module);
use warnings;
use Scalar::Util qw/blessed weaken/;
-use Mouse::Util qw/version authority identifier get_code_info/;
+use Mouse::Util qw/get_code_info/;
use Carp 'confess';
sub name { $_[0]->{package} }
sub _method_map{ $_[0]->{methods} }
+
+sub version { no strict 'refs'; ${shift->name.'::VERSION'} }
+sub authority { no strict 'refs'; ${shift->name.'::AUTHORITY'} }
+sub identifier {
+ my $self = shift;
+ return join '-' => (
+ $self->name,
+ ($self->version || ()),
+ ($self->authority || ()),
+ );
+}
+
+
sub namespace{
my $name = $_[0]->{package};
no strict 'refs';
our @EXPORT_OK = qw(
get_linear_isa
apply_all_roles
- version
- authority
- identifier
get_code_info
);
our %EXPORT_TAGS = (
sub get_code_info($) {\r
my ($coderef) = @_;\r
ref($coderef) or return;\r
+
my $cv = B::svref_2object($coderef);\r
$cv->isa('B::CV') or return;
my $gv = $cv->GV;\r
- # bail out if GV is undefined\r
- $gv->isa('B::SPECIAL') and return;\r
+ $gv->isa('B::GV') or return;\r
\r
return ($gv->STASH->NAME, $gv->NAME);\r
}\r
}
-{ # adapted from Class::MOP::Module
-
- sub version { no strict 'refs'; ${shift->name.'::VERSION'} }
- sub authority { no strict 'refs'; ${shift->name.'::AUTHORITY'} }
- sub identifier {
- my $self = shift;
- join '-' => (
- $self->name,
- ($self->version || ()),
- ($self->authority || ()),
- );
- }
-}
-
# taken from Class/MOP.pm
{
my %cache;
my @classes = @_
or return;
- foreach my $class (@classes) {
+ my $found;
+ my %exceptions;
+ for my $class (@classes) {
unless ( _is_valid_class_name($class) ) {
my $display = defined($class) ? $class : 'undef';
confess "Invalid class name ($display)";
}
- }
- my $found;
- my %exceptions;
- for my $class (@classes) {
my $e = _try_load_one_class($class);
if ($e) {
else {
Mouse::Meta::Role->combine_apply($meta, @roles);
}
-
+ return;
}
1;