12 *UNIVERSAL::a_sub_not_likely_to_be_here = sub {
15 # deviation from Scalar::Util
16 # XS returns undef, PP returns GLOB.
17 # let's make that more consistent by having PP return
18 # undef if it's a GLOB. :/
20 # \*STDOUT would be allowed as an object in PP blessed
22 return $ref eq 'GLOB' ? undef : $ref;
27 local($@, $SIG{__DIE__}, $SIG{__WARN__});
29 ? eval { $_[0]->a_sub_not_likely_to_be_here }
33 'looks_like_number' => sub {
36 # checks from perlfaq4
37 return 0 if !defined($_) or ref($_);
38 return 1 if (/^[+-]?\d+$/); # is a +/- integer
39 return 1 if (/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/); # a C float
40 return 1 if ($] >= 5.008 and /^(Inf(inity)?|NaN)$/i) or ($] >= 5.006001 and /^Inf$/i);
45 local($@, $SIG{__DIE__}, $SIG{__WARN__});
49 length($t = ref($r)) or return undef;
51 # This eval will fail if the reference is not blessed
52 eval { $r->a_sub_not_likely_to_be_here; 1 }
55 # we have a GLOB or an IO. Stringify a GLOB gives it's name
57 $q =~ /^\*/ ? "GLOB" : "IO";
60 # OK, if we don't have a GLOB what parts of
61 # a glob will it populate.
62 # NOTE: A glob always has a SCALAR
64 defined *glob{ARRAY} && "ARRAY"
65 or defined *glob{HASH} && "HASH"
66 or defined *glob{CODE} && "CODE"
67 or length(ref(${$r})) ? "REF" : "SCALAR";
75 loaded => \&mro::get_linear_isa,
77 # this recurses so it isn't pretty
82 my $classname = shift;
84 my @lin = ($classname);
86 foreach my $parent (@{"$classname\::ISA"}) {
87 my $plin = $code->($parent);
89 next if exists $stored{$_};
101 our @EXPORT_OK = map { keys %$_ } values %dependencies;
103 for my $module_name (keys %dependencies) {
104 (my $file = "$module_name.pm") =~ s{::}{/}g;
107 local $SIG{__DIE__} = 'DEFAULT';
108 eval "require '$file'; 1";
111 for my $method_name (keys %{ $dependencies{ $module_name } }) {
112 my $producer = $dependencies{$module_name}{$method_name};
115 if (ref($producer) eq 'HASH') {
116 $implementation = $loaded
117 ? $producer->{loaded}
118 : $producer->{not_loaded};
121 $implementation = $loaded
122 ? $module_name->can($method_name)
127 *{ __PACKAGE__ . '::' . $method_name } = $implementation;