Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

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

    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.


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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2015-07-07 11:02 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (88 votes), past polls