File: C:/mod_perl-2.0.12/WrapXS/ModPerl/Util/Util.pm
#
# /*
# * *********** WARNING **************
# * This file generated by ModPerl::WrapXS/0.01
# * Any changes made here will be lost
# * ***********************************
# * 01: lib/ModPerl/Code.pm:716
# * 02: lib/ModPerl/WrapXS.pm:635
# * 03: lib/ModPerl/WrapXS.pm:1186
# * 04: Makefile.PL:435
# * 05: Makefile.PL:333
# * 06: Makefile.PL:59
# */
#
package ModPerl::Util;
use strict;
use warnings FATAL => 'all';
use Apache2::XSLoader ();
our $VERSION = '2.000012';
Apache2::XSLoader::load __PACKAGE__;
#Extra stuff
our $DEFAULT_UNLOAD_METHOD ||= "unload_package_pp";
sub unload_package {
goto &$DEFAULT_UNLOAD_METHOD;
}
sub unload_package_pp {
my $package = shift;
no strict 'refs';
my $tab = \%{ $package . '::' };
# below we assign to a symbol first before undef'ing it, to avoid
# nuking aliases. If we undef directly we may undef not only the
# alias but the original function as well
for (keys %$tab) {
#Skip sub stashes
next if /::$/;
my $fullname = join '::', $package, $_;
# code/hash/array/scalar might be imported make sure the gv
# does not point elsewhere before undefing each
if (%$fullname) {
*{$fullname} = {};
undef %$fullname;
}
if (@$fullname) {
*{$fullname} = [];
undef @$fullname;
}
if ($$fullname) {
my $tmp; # argh, no such thing as an anonymous scalar
*{$fullname} = \$tmp;
undef $$fullname;
}
if (defined &$fullname) {
no warnings;
local $^W = 0;
if (defined(my $p = prototype $fullname)) {
*{$fullname} = eval "sub ($p) {}";
}
else {
*{$fullname} = sub {};
}
undef &$fullname;
}
if (*{$fullname}{IO}) {
local $@;
eval {
if (fileno $fullname) {
close $fullname;
}
};
}
}
#Wipe from %INC
$package =~ s[::][/]g;
$package .= '.pm';
delete $INC{$package};
}
1;
__END__