Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Re: Way of the Spinner (repost)

by TheDamian (Priest)
on Jan 18, 2003 at 19:06 UTC ( #228030=note: print w/ replies, xml ) Need Help??


in reply to Re: Way of the Spinner (repost)
in thread Way of the Spinner (repost)

Or if, like most geeks, you have an aversion to a visible tie, you can make the interface much cleaner with:

use Attribute::Handlers; use Tie::Cycle; sub UNIVERSAL::Spinner : ATTR(SCALAR) { tie ${$_[2]}, 'Tie::Cycle', [map $_."\b" x length, @{$_[4]||[qw(\ | / -)]}] }

And then whip up custom spinners very elegantly, as the need arises:

$|=1; my $spinner : Spinner; print $spinner for (1..10000); my $morse_blinker : Spinner( qw(! : .) ); print $morse_blinker for (1..10000); my $wobbler : Spinner( "\)", "\(" ); print $wobbler for (1..10000); my $flexer : Spinner( '< ', ' >' ); print $flexer for (1..10000);


Comment on Re: Re: Way of the Spinner (repost)
Select or Download Code
Re: Re: Re: Way of the Spinner (repost)
by demerphq (Chancellor) on Jan 20, 2003 at 16:08 UTC
    Cool!

    Although I admit until now ive been one of those geeks that doesnt mind the explicit Tie.

    :-)

    --- demerphq
    my friends call me, usually because I'm late....

Re: Re: Re: Way of the Spinner (repost)
by !unlike (Beadle) on Jan 23, 2003 at 09:08 UTC
    TheDamian that was exactly what I ultimately wanted to achieve but had no idea how. A definate ++ to you. The Attribute::Handlers is a new module to me so I'll go and look it up.

    Thanks

    !unlike
    "The price if ignorance, which is of course that you must learn from those who know." Scorates (paraphrased)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://228030]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2014-07-29 05:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (211 votes), past polls