wazzuteke has asked for the wisdom of the Perl Monks concerning the following question:
package MyPackage; use warnings; use strict; sub import { my ( $caller ) = caller; my $cpackage = $caller; $cpackage =~ s/::/\//g; my ( undef, $function ) = ( shift, shift ); # I know, I know # # This is just an example. I know re-defining # BEGIN in the caller has it's problems, but I'm # trying to keep it simple for this snippet # { no strict 'refs'; eval( qq^ sub ${caller}::BEGIN { delete( $INC{'${cpackage}\.pm'} ); # # I've tried the following, too: # no warnings 'redefine'; # delete( %{ "${caller}::${function}" } ); # FILTER{} # etc. # # I get the re-define warning here require ${caller}; } ^); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: unimport warnings in another package
by diotalevi (Canon) on Mar 21, 2007 at 07:10 UTC | |
by wazzuteke (Hermit) on Mar 21, 2007 at 13:05 UTC | |
by diotalevi (Canon) on Mar 21, 2007 at 15:42 UTC | |
|
Re: unimport warnings in another package
by shigetsu (Hermit) on Mar 21, 2007 at 06:33 UTC | |
by wazzuteke (Hermit) on Mar 21, 2007 at 12:51 UTC | |
|
Re: unimport warnings in another package
by ysth (Canon) on Mar 21, 2007 at 06:44 UTC | |
by wazzuteke (Hermit) on Mar 21, 2007 at 13:02 UTC | |
|
Re: unimport warnings in another package
by rhesa (Vicar) on Mar 21, 2007 at 16:09 UTC | |
|
Re: unimport warnings in another package
by Anonymous Monk on Mar 21, 2007 at 06:47 UTC | |
by wazzuteke (Hermit) on Mar 21, 2007 at 13:03 UTC |