This is the code segment I was working with.  When I
hit Crtl + C, or whatever, it doesn't break at all. 
It just keeps on going...  Just to make sure I have
all my basis covered, what are some of the other linux
break keystrokes?  Here's the unbreakable code, which
I want to be made breakable:

$SIG{INT} = \&end;

run();

sub run {
while (1) {
print "blah\n";
}}

sub end {
$SIG{QUIT} = \&end;
print "ending\n";
die;
}

--- "Bradley M. Handy" <[EMAIL PROTECTED]>
wrote:
> If you are using the Term::ReadKey module, what read
> module do you have it
> in?  Can you post your code?
> 
> Brad Handy
> 
> --www.jack-of-all-trades.net
> [EMAIL PROTECTED]
> 
> > -----Original Message-----
> > From: Thomas Jakub [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, July 15, 2001 2:33 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: breakable loop???
> >
> >
> > Maybe I should try to rewrite my email in a more
> easy
> > to understand way, since no one is replying...
> >
> > I did the SIG{INT} thingie, and even had a die;
> > command at the end of it, but I can't break out of
> the
> > function.  Crtl + C does nothing.  So, die; does
> make
> > it so Crtl + C works, even if there is a SIG{INT}
> > thingie in there?
> >
> > --- Thomas Jakub <[EMAIL PROTECTED]> wrote:
> > > maybe I'm not implementing the SIG{ING} thingie
> > > right...
> > > I had a die; command in there, but that didn't
> > > work...
> > >
> > > --- Thomas Jakub <[EMAIL PROTECTED]> wrote:
> > > > Ummm...  I can't seem to break out of my
> infinite
> > > > loops by doing crtl + c...  consequently, I
> can't
> > > go
> > > > into the SIG{INT} function...  I tried Crtl +
> > > > Backspace, but that didn't work to well
> either...
> > > > Crtl + S stopped it, but that was it...  What
> are
> > > > the
> > > > control signals for unix?  Or am I doing
> something
> > > > wrong, or what?
> > > >
> > > > --- Will Cottay <[EMAIL PROTECTED]> wrote:
> > > > > You might want to look at the CPAN module
> > > > > Term::ReadKey.  It provides
> > > > > for
> > > > > non-blocking reads.
> > > > >
> > > > > Or, you could install a signal handler ie:
> > > > >
> > > > > $SIG{INT} = \&report_stats;
> > > > >
> > > > > while (1) {
> > > > > ... your website checking code here ...
> > > > >  }
> > > > >
> > > > > sub report_stats {
> > > > >     $SIG{QUIT} = \&report_stats;
> > > > >     ...Your stat reporting and exit code
> here
> > > > > }
> > > > >
> > > > > and hit ^C when you want it to report and
> stop.
> > > > >
> > > > >
> > > > >
> > > > > 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?
> > > > > >
> > > > > > >
> > > > > > >                                   Adam
> > > Carson
> > > > > > >                                 MIS
> > > Department
> > > > > > >                              Berkeley
> > > County,
> > > > SC
> > > > > > >
> > > > > > > >>> Thomas Jakub <[EMAIL PROTECTED]>
> > > 07/12/01
> > > > > > > 02:20PM >>>
> > > > > > > so...  is their a function that won't
> wait
> > > for
> > > > > me to
> > > > > > > hit enter, and can still get the keys? 
> Or
> > > > > rather,
> > > > > > > one
> > > > > > > that will read only once every time it
> goes
> > > > > through
> > > > > > > the while loop?
> > > > > > >
> > > > > > > --- Adam Carson
> <[EMAIL PROTECTED]>
> > > > > wrote:
> > > > > > > > Aaron,
> > > > > > > >   If you read the rest of my post, I
> > > mention
> > > > > that
> > > > > > > > there is still a problem with the
> code, ie
> > > > the
> > > > > > > > waiting for STDIN.  I was just
> pointing
> > > out
> > > > > one
> > > > > > > flaw
> > > > > > > > in the streamlined version, as it
> seemed
> > > to
> > > > be
> > > > > the
> > > > > > > > better way to go for that particular
> task.
> > >
> > > > I
> > > > > too
> > > > > > > > read the perldocs and saw the same
> thing.
> > > > In
> > > > > > > fact,
> > > > > > > > I suggested to Thomas that he check
> them
> > > > > regarding
> > > > > > > > just that problem.  That message also
> went
> > > > to
> > > > > the
> > > > > > > > list.
> > > > > > > >
> > > > > > > >                      Regards,
> > > > > > > >
> > > > > > > >                                   Adam
> > > > Carson
> > > > > > > >                                 MIS
> 
=== message truncated ===


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

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to