Egads.
Although I haven't looked inside Test::More, I think I see what you're talking about. I tried this:
~~~ yields ~~~#!/usr/bin/perl use warnings; use strict; sub tear_us_outta_here { print "Getting out of loop labeled FOO.\n"; last FOO; } FOO: for ( 1 .. 10 ) { print "At $_.\n"; if ( $_ == 4 ) { tear_us_outta_here(); } }
That looks kinda' weird and scary to me... :)At 1. At 2. At 3. At 4. Getting out of loop labeled FOO. Exiting subroutine via last at ./foo.pl line 8.
Heh,.. for this sort of stuff, we should have a Halloween Perl-ghost-story-hour every October:
{dark room with flashlight shining up on an upright dead-tree printout of some code}:;)
"On this very line of code, many iterations ago, for no apparent reason, the loop... abruptly ended! Some say it was a hardware failure, others suggest deep magic at work in the bowels of the interpreter..."
EDIT: Thanks for all the replies and interesting suggestions folks. Seems like, as Ovid suggests, the original author of the code I'm looking at just used the labels as some off form of odd commenting -- especially considering that there isn't any pod in the code.
In reply to Re^2: What's the point of a labeled block without a loop?
by JohnMG
in thread What's the point of a labeled block without a loop?
by JohnMG
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |