Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Writing an opinion poll in perl.

by benn (Vicar)
on Sep 20, 2003 at 10:24 UTC ( #292839=note: print w/replies, xml ) Need Help??

in reply to Writing an opinion poll in perl.

I'm sure there must be some modules lying around on CPAN to do exactly this, but if you want to roll your own...
  • work out the minimum and maximum values of the graph - foreach (keys %survey) {$max = $_ if $survey{$_} > $survey{$max}; repeat and rinse for $min} or something.
  • Do some maths to work out your scale factor,depending on how big you want your graph
  • decide how you want to do your graphics - the two most common ways are stretching a single-pixel (<img width=$value height=$size_of_a_column src='pixel.gif' >) or just printing <td>'s with coloured backgrounds - either a single td with a styled size (using padding-right or similar) or a bunch of 'unit' cells that get filled in or not as the case may be.
  • From then on it's all just print loops... :)
HTH, Ben.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://292839]
[Corion]: 1nickt: Not in the general sense... I only have very specific crawlers, but not a simple crawler like that ;) But maybe that would be a good application/( stress) test for Future::HTTP to parallelize
[Corion]: Also, a good application to test my API to rate limit things

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2017-10-18 11:32 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (244 votes). Check out past polls.