Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-19 11:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found