[Israel.pm] Uses for Attributes

Jason Elbaum jason.elbaum at gmail.com
Tue Mar 20 04:27:09 PDT 2007

> I tried to show you some uses for it in my previous message. If we
> take the writing a testing library as an example, I can mark the
> functions that are directly used for test assertion with the ":
> testfunc" attribute and then walk the caller() (
> http://perldoc.perl.org/functions/caller.html ) stack backwards to
> find the top function with this marker and then display the context
> that it has. This beats Test::Builder's current method of doing local
> $Test::Builder::Level = $Test::Builder::Level + 2;

In my testing framework, I do that by walking up the caller stack to
the first function not inside the Test package. Simple enough, no?

Jason Elbaum

More information about the Perl mailing list