in reply to IO::Socket::SSL & Net::Websocket::Server Question
Found in /usr/lib/perl5/5.20.0/pod/perlfaq7.pod How do I clear a package? Use this code, provided by Mark-Jason Dominus: sub scrub_package { no strict 'refs'; my $pack = shift; die "Shouldn't delete main package" if $pack eq "" || $pack eq "main"; my $stash = *{$pack . '::'}{HASH}; my $name; foreach $name (keys %$stash) { my $fullname = $pack . '::' . $name; # Get rid of everything with that name. undef $$fullname; undef @$fullname; undef %$fullname; undef &$fullname; undef *$fullname; } } # Or, if you're using a recent release of Perl, you can just use the # Symbol::delete_package() function instead.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: IO::Socket::SSL & Net::Websocket::Server Question
by Anonymous Monk on Jul 29, 2014 at 17:50 UTC | |
by noxxi (Pilgrim) on Jul 29, 2014 at 19:45 UTC |