Lets say you have a perl script sucking rows out of a database. You generally want to know that it's still running, instead of it sitting there, working it's butt off, and not printing anything while it performs some math or hashing or something. This whirleygig prints a character to stdout or stderr so you can see it working.
#!/usr/bin/perl $|=1;$WHIRLEY_COUNT=-1; #$whirley='-\|/';@whirley=split //,$whirley; #$whirley='.o0O0o';@whirley=split //,$whirley; #$whirley='1234567890';@whirley=split //,$whirley; #$whirley='';@whirley=split //,$whirley; $whirley=" ".pack(C,176).pack(C,177).pack(C,178).pack(C,219).pack(C,17 +8).pack(C,177). pack(C,176);@whirley=split //,$whirley; sub whirley { if ($WHIRLEY_COUNT+1==@whirley) { $WHIRLEY_COUNT=0; } else { $WHIRLEY_COUNT++; } return "@whirley[$WHIRLEY_COUNT]"; } while (1) { sleep 1; print STDERR "please wait : ".&whirley."\r"; }

In reply to A whirleygig for a progress indicator for scripts by da w00t

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.