Slash Boxes
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.
More | Login | Reply
Loading... please wait.
  • I'd also considered using a similar technique for similar scoping reasons. Make sure you're handling reentrancy correctly (although this may not be a problem if this technique is for unit testing).

    Would it be possible to show the code in which this is used? I'm having trouble thinking of a situation in which local woudn't cut it (although there obviously is if several different people have thought of this technique).

    I really like the name "scripting token". My first thought was to call the scalar a "canary"
    • I can give a little, though I think in most cases I didn't use it in as novel ways as I conceived that I would. (I'll have to redact a bit, but that's okay.) But I have a mean over-engineering streak...

      The method in the journal entry exists in my project Testing superclass (which isa Test::Class.) In addition, there is:

      sub mock_network {
          my $proto = shift;
          $proto->mock_class_constructor( NETWORK_PKG() . '::new', @_ );
      sub mock_implementation {
          my $proto = shi

  • ... not quite the same, but similar motivation. Rather than just "entangling" the scoping token with the thing they want to control scope of however, it wraps it.