in reply to Re: Re: Locking PERL code another way
in thread Locking PERL code another way
{ my $giveMD5 = \&Foo::giveMD5; my %givenMD5; *Foo::giveMD5 = sub { my $md5 = $givenmd5{@_} ||= $giveMD5->( @_ ); # execute old to obt +ain "real" MD5 # do evil things to op tree for given parameters if first time return $md5; # the "right" value }; }
Of course, this is more or less pseudo-code to give you the idea.
By the way, this "wrapping" technique is used in all sorts of Perl modules, so disabling this feature in Perl is basically impossible.
Liz
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Locking PERL code another way
by Anonymous Monk on Sep 26, 2003 at 04:06 UTC | |
by liz (Monsignor) on Sep 26, 2003 at 09:31 UTC | |
|
Re: Re: Re: Re: Locking PERL code another way
by Anonymous Monk on Dec 19, 2003 at 02:25 UTC |