3 sub _getglob { \*{$_[0]} }
8 our @EXPORT = qw(_getglob _install_modifier _load_module _maybe_load_module);
10 sub _install_modifier {
11 my ($into, $type, $name, $code) = @_;
13 if (my $to_modify = $into->can($name)) { # CMM will throw for us if not
15 Sub::Defer::undefer_sub($to_modify);
18 Class::Method::Modifiers::install_modifier(@_);
24 return 1 if $_[0]->can('can');
25 (my $proto = $_[0]) =~ s/::/\//g;
26 require "${proto}.pm";
30 sub _maybe_load_module {
31 return $MAYBE_LOADED{$_[0]} if exists $MAYBE_LOADED{$_[0]};
32 (my $proto = $_[0]) =~ s/::/\//g;
33 if (eval { require "${proto}.pm"; 1 }) {
34 $MAYBE_LOADED{$_[0]} = 1;
36 if (exists $INC{"${proto}.pm"}) {
37 warn "$_[0] exists but failed to load with error: $@";
39 $MAYBE_LOADED{$_[0]} = 0;
41 return $MAYBE_LOADED{$_[0]};