use strict;
use warnings;
use base qw/Exporter/;
-use Carp;
+use Carp qw(confess);
+use B ();
our @EXPORT_OK = qw(
get_linear_isa
version
authority
identifier
+ get_code_info
);
our %EXPORT_TAGS = (
all => \@EXPORT_OK,
*{ __PACKAGE__ . '::get_linear_isa'} = $impl;
}
+{ # taken from Sub::Identify
+ 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
+\r
+ return ($gv->STASH->NAME, $gv->NAME);\r
+ }\r
+}
+
{ # adapted from Class::MOP::Module
sub version { no strict 'refs'; ${shift->name.'::VERSION'} }
}
( $_->[0]->can('meta') && $_->[0]->meta->isa('Mouse::Meta::Role') )
- || croak("You can only consume roles, "
+ || confess("You can only consume roles, "
. $_->[0]
. " is not a Moose role")
foreach @roles;