Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Re: Way of the Spinner (repost)

by TheDamian (Vicar)
on Jan 18, 2003 at 19:06 UTC ( [id://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);

Replies are listed 'Best First'.
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)
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....

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2024-03-28 19:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found