develooper Front page | perl.perl5.porters | Postings from January 2012

Tying special variables considered horrible and useful

Thread Previous | Thread Next
From:
Steffen Mueller
Date:
January 18, 2012 14:34
Subject:
Tying special variables considered horrible and useful
Message ID:
4F1748DB.7080409@cpan.org
On 01/18/2012 11:04 PM, Father Chrysostomos via RT wrote:
> On Wed Jan 18 12:53:06 2012, rcaputo wrote:
>> Interoperability requires cooperation from the author, and he's been
>> known to break it for modules he doesn't like.  Ask Paul Evans and/or
>> Matt Trout about this:
>>
>> https://metacpan.org/source/MLEHMANN/AnyEvent-
>> 6.13/lib/AnyEvent.pm#L1396
>
> Tying %INC could solve that. :-)

Other fun aside: Tying special variables can actual be very useful. I 
was surprised to learn that tying %SIG works just fine. It's very useful 
for cases of "huge codebase" and "where are my warnings going" or 
similar problems. IOW Devel::TrackSIG will tie %SIG (if loaded early) 
and tell you where the current value of $SIG{$whatever} comes from for 
debugging at any place where you otherwise expect an exception out warning.

Doesn't matter up to a ~ 10k line code base, I guess, but at some point, 
it can get pretty hairy to figure this out manually.

--Steffen

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About