[Israel.pm] how to intercept module calls

Tal Kelrich tal at musicgenome.com
Sun Oct 8 10:34:25 PDT 2006


On Sun, 8 Oct 2006 19:15:10 +0200
Yuval Kogman <nothingmuch at woobling.org> wrote:

> If you want to do this "manually", use Class::Inspector or
> Devel::Symdump or something like that to get at all the functions,
> then do something like
> 
> 	my $orig_sub = \&{ "Module::$subname" };
> 	*{"Module::$subname"} = sub {
> 		warn "going to call orig sub ($su name) with the
> args: @_"; goto &$orig_sub;
> 	};

Thanks, I might do so (even though I'm trying to make a featherweight
wrapper).

I more or less found what I was looking for in Hook::WrapSub, it boils
down to the sample you just gave, with some additional unwrapping code.
I suggest anyone else looking for similar look there.

Regards,
	Tal Kelrich


-- 
Tal Kelrich
PGP fingerprint: 3EDF FCC5 60BB 4729 AB2F  CAE6 FEC1 9AAC 12B9 AA69
Key Available at: http://www.hasturkun.com/pub.txt
----
Bender: Oh no! Not the magnet!
----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://perl.org.il/pipermail/perl/attachments/20061008/649979bc/attachment.pgp 


More information about the Perl mailing list