From: Steffen Müller <0mgwtfbbq@sneakemail.com> Date: Sun, 25 Aug 2002 00:27:59 +0000 (+0200) Subject: Re: if.pm bug. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a3e5cfd4c30bff9d1d50fd3f8db258b33693d62c;p=p5sagit%2Fp5-mst-13.2.git Re: if.pm bug. From: "Steffen Mueller" Message-ID: <20020824222210.16387.qmail@onion.perl.org> p4raw-id: //depot/perl@17799 --- diff --git a/lib/if.pm b/lib/if.pm index 32c4fad..0795dee 100644 --- a/lib/if.pm +++ b/lib/if.pm @@ -1,13 +1,16 @@ package if; -our $VERSION = '0.01'; +our $VERSION = '0.02'; sub work { my $method = shift() ? 'import' : 'unimport'; return unless shift; # CONDITION - my $p = shift; # PACKAGE + + my $p = $_[0]; # PACKAGE eval "require $p" or die; # Adds .pm etc if needed - $p->$method(@_) if $p->can($method); + + my $m = $p->can($method); + goto &$m if $m; } sub import { shift; unshift @_, 1; goto &work }