http://qs321.pair.com?node_id=191838

I find myself writing snippets of code inside other modules and scripts that look like this:
{ # localize $foo my $foo = 0; use constant FOO_CYCLE => 23; sub note_a_foo { $foo++; } sub check_foo { return unless $foo >= FOO_CYCLE; $foo = 0; do_something_about_foo; } }
And then elsewhere:
for (long_loop) { ... note_foo; ... }
The block localizing the $foo counter isn't really an object; what would you call it? I've got enough of these now in my production code that I'd like to have some term for them, like "nugget" or "black box" or "micro-object", so that my documentation for each can be more immediately meaningful to another reader. Is there a commonly used term for such a construct?
-- Jeff Boes vox 269.226.9550 ext 24 Database Engineer fax 269.349.9076 Nexcerpt, Inc. http://www.nexcerpt.com ...Nexcerpt...Connecting People With Expertise