Cool!  I'll play around with this tommorrow when I'm
less sleepy...

--- David Labatte <[EMAIL PROTECTED]> wrote:
> I did a quick search of CPAN and found that
> Term::ReadKey should
> be able to do exactly what you ask.  I'm not sure
> how platform
> dependent it is, but I do remember using it once and
> having some
> problems with it under dos (but that was eon's ago
> and I can't
> remember exactly what I was trying to do [knowing me
> most
> likely something obscure, weird, stupid and wrong..
> but interesting,
> in an attempt to avoid /real work/  { like now } ]
> ).
> 
> It's pod does say one of it's design goals was/is
> platform
> independence so most likely that won't be a problem.
>  I coded
> a quick test script under linux and the package
> appears to
> fulfill all your requirements.
> 
> Hope that's helpful.
> 
> #--------- test script that can be safely ignored if
> you desire since
> #--------- it's only a rehash of the example from
> the pod
> 
> 
> ## horribly plagiarized from the perldoc and coded
> ## as a /FUN/ example
> use Term::ReadKey;
> ReadMode 4; # Enter raw mode
> 
> my ($tab,$index) = (0,1);
> 
> # -1 means use a non blocking read
> while ( not defined( $key = ReadKey(-1) ) ) {
>   $index++;
>   $tab = int(sin(($index % 236) /75) * 75);
>   print '.' x $tab . "I'M HUNGRY...FEED ME" .( '.' x
> (75 - $tab)) .
> "\n";
> }
> 
> $key = $key =~ /\n/ ? "a firmly pressed enter key"
>                     : "'$key' characters";
> print "Thank you! I just love the taste of $key in
> the morning.\n";
> 
> ReadMode 0; # Reset tty mode before exiting
> 
> 
> 
> Thomas Jakub wrote:
> 
> > --- Adam Carson <[EMAIL PROTECTED]> wrote:
> > > Since you said that you are trying to hit a
> > > webserver until you tell it to stop, you might
> want
> > > it to check for a different condition, such as a
> > > certain number of hits or a timeout, etc.  In
> Pascal
> > > there is a getkey function, I don't think Perl
> has
> > > an equivalent though.
> >
> > I got it so it does it for as many iterations as
> you
> > specify, but I was hoping to get it so it could do
> it
> > continiously until someone hits enter.  Like,
> maybe I
> > could start it on Friday, sometime, without any
> > concern for how many iterations it does per
> second,
> > and on monday, I can just hit enter to terminate
> it,
> > and get the run time statistics of it, thus far. 
> Or
> > maybe just do it until I need to reboot the
> computer -
> > I could just hit enter, and reboot...
> > Anyhow, someone suggested that I do it with
> threads...
> >  how would I do this?
> >
> 
> --
> Perl, because 600 billion oysters can't be wrong
>    Canadian Consulting Services' pet perl hacker
>    David Labatte [EMAIL PROTECTED]
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Reply via email to