Ok, just been teaching myself about
tie, and thought I was getting the hang of it, so I built myself two things:
1. Stopwatch.pm
This module has, surprisingly, four methods. No prizes for guessing what they're called!
Now then, each sub in Stopwatch contains a print statement along the lines of:
print ("Inside Stopwatch::TIESCALAR"); so I know which sub is being executed.
2. go.pl, in its entirety, is here:
use Stopwatch;
print "Just executed use\n";
tie $s, 'Stopwatch';
print "Just executed tie\n";
$s = 0;
print "Just executed \$s = 0;\n";
print "$s\n";
print "Just executed print \$s\n";
$s = undef;
print "Just executed undef\n";
So what? I hear you cry...
Well, all's well untill the
print "$s\n"; statement. It calls Stopwatch::FETCH twice in a row. Why??? For some reason this small 'feature' is really getting under my skin, any explanations very welcome!
advTHANKSvance,
SMiTZ
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.