I would do a bit of research for you and get you some links and
examples together, but at work, unfortunately, the internet filtering
is rather draconian. So let's talk through about the ideal and how you
would go about figuring this out.
First, you would install the signal handler within your own session.
If you aren't instantiating your own session (just firing up
Client::Ping and then doing a POE::Kernel->run()) then see if
Client::Ping allows for you to store user defined states. I don't know
anything about Client::Ping, so I can't tell you for sure where to
install the sig handler.
But just to be clear so you can figure it out: anytime you are mucking
about with the kernel reference, it is context sensitive; meaning that
if you ask it to watch file handles or capture signals, it does it
from within the context of where ever you asked to do so. Typically,
this is within your own Session that you have defined. That is how
Wheels work. They do all of the magical kernel setup within the
context of whatever session you are currently within.
With that said, I don't know how Client::Ping handles interaction with
the end-developer. If it asks for user defined subs for various events
and provides an area for extra events (like Client::TCP) then you
would feed it the $kernel->sig('INT' => 'foo') in the startup event of
Client::Ping with your 'foo' event defined within the context of
Client::Ping.
Since I can't get out to http://poe.perl.org right now, I can't get
you any links to any examples how this is done, but I encourage you
(and other people on the list that can get there from work *HINT
HINT*) to look around for yourself.
On 5/23/06, Stuart Kendrick <[EMAIL PROTECTED]> wrote:
hi nicholas,
i don't think i'm smart enough to understand what you just said ...
i use POE::Component::Client::Ping ... i don't actually write my own stuff
...
so ... i would modify Kernel.pm ... no, i don't see that Kernel.pm defines
SIG{INT}, for example ...
ok, i would modify Ping.pm to send my own "$kernel->sig( INT =>
'event_sigint' );" ... no, Ping.pm doesn't do that either
i'm not clear on how i would modify POE to use POE's signal handlers when
it needs to and my signal handlers otherwise. would you elaborate?
--sk
On Mon, 22 May 2006, Nicholas Perez wrote:
> Or! You could install the signal handlers within POE so you get all of
> the POE dispatching goodness with your signal handlers.
>
> On 5/22/06, David Davis <[EMAIL PROTECTED]> wrote:
> > You could move the use POE line above the two use sigtrap lines.
> >
> > David
> >
> > On 22 May 2006 14:07:57 -0700, sbk <[EMAIL PROTECTED]> wrote:
> > >
> > > hi,
> > >
> > > i'm realizing that loading POE replaces my signal handlers
> > >
> > > is there a way around this? i rather like my signal handlers ... :)
> > > they perform useful chores, like clean up shared memory segments.
> > > of
> > > course, i rather like POE, too ... it does useful things for me ...
> > > naturally, i want both!
> > >
> > > --sk
> > >
> > > stuart kendrick
> > > fhcrc
> > >
> > >
> > > guru% cat test
> > > #!/opt/vdops/bin/perl
> > > use strict;
> > > use warnings;
> > > use sigtrap 'handler' => \&shut_down, 'normal-signals';
> > > use sigtrap 'handler' => \&shut_down, 'error-signals';
> > > use POE;
> > >
> > > while (1) {
> > > sleep 60;
> > > }
> > >
> > > sub shut_down {
> > > die "yay!";
> > > }
> > > guru%./test
> > > [hit Ctrl-C here]
> > > guru%
> > >
> > > whereas if i remove the 'use POE;' line, i see the following:
> > >
> > > guru%./test
> > > yay! at ./test line 13.
> > > guru%
> > >
> > >
> >
> >
>