Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Colorize

by extremely (Priest)
on Jun 13, 2001 at 06:58 UTC ( #87994=note: print w/ replies, xml ) Need Help??


in reply to Colorize

Well, not to toot my own horn too much but you could add my Web Color Spectrum Generator to yours and let it scale a color spectrum across the text. That is one of the two uses I built it for, the other being coloring table rows.

--
$you = new YOU;
honk() if $you->love(perl)


Comment on Re: Colorize
Re: Re: Colorize
by WrongWay (Pilgrim) on Jun 13, 2001 at 07:45 UTC
    I actaully looked at that, but deemed it too much for my needs.

    I am currently using this sub to colorize 1,000s of mp3 titles on a private mp3 jukebox of mine. Everytime time I generate the list(do a search) this sub gets called 1,000s of times. I wanted it to keep it light and tight so to speak. Just the basics. Get in and get out quick.

    WrongWay
      If speed is a concern, among other things, you might move the declaration of @colors out into an enclosing block:
      { my @colors=(...); sub colorize { ... } }
      This way, @colors will still have only be 'locally' visible to colorize, but it will only be created once, at load-time, instead of every time you call colorize();.
        And be sure that's in a BEGIN block, not just a naked block, or else there's a chance that the initializer for @colors might not have run yet.

        Wrong:

        { my @colors=(...); sub colorize { ... } }

        Right:

        BEGIN { my @colors=(...); sub colorize { ... } }

        -- Randal L. Schwartz, Perl hacker
        Be sure to read my standard disclaimer if this is a reply.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2014-09-02 10:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (21 votes), past polls