Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Hi patrick

    while I agree that contextual variables are a very neat solution, do they not make using these variables very slow?

    Even when not using contextual variables explicitly, every use of say() would need to check that no caller has overridden the value of $*OUT

    Clint

    • From what I can tell, contextuals don't appear to me to be all that much slower than ordinary lexicals. There might be a case where a deeply nested call stack could increase the search time, but I suspect that will be rather rare.

      Beyond that, there are all sorts of ways to optimize for the cases where speed ends up being more important than flexibility. For example, a block that is going to make a lot of calls to say() can do:

      my $*OUT = CALLER::<$*OUT>;

      and this will reduce the number of caller con