Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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);

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
Node Status?
node history
Node Type: note [id://228030]
help
Chatterbox?
[marto]: I think that actually caught up with me yesterday, felt a really sharp pain where my neck meets my skull.
[Corion]: marto: Ouch, yeah...
[marto]: the boys uncle will take them for a couple of hours this afternoon :)
[marto]: only at work 3 days this week, then off to Copenhagen for a wedding

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2017-11-19 11:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (280 votes). Check out past polls.

    Notices?