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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.