Frozen Perl 2011: ‎Wrapping Installed Subroutines: Wear a Raincoat in Someone Else's Perl

Wrapping installed subroutines

Steven Lembark gave a talk about wrapping installed subroutines.

It was noted on irc that this was the cotinuation/sequal of another talk. The jumping off point is having to work in some code and it has the following at the top of every program/module

use warnings;
$SIG{ WARN } = sub { die };

Now think about what that does...

Yes, you are now screwed.

Especially if you want to do any benchmarking or deal with some other modules.

You can muck about with the symbol table and such but one solution is the Symbol module.

Lembark chose this because it is part of the core/standard libraries (a predication of his talk). It cleans up some of the mess of dealing with globs/symbol table weirdness.

It was noted on irc that Package::Stash is a bit cleaner to use (at least its API is better).

Regardless it was yet more of Lembark showing some of the weird things that you can do (and some times have to do) and why it is better to find a module to give you some distance from that mental mayhem.

As always, he shows off interesting bits of the Perl solution space.

Leave a comment

About gizmo_mathboy

user-pic I blog about Perl.