Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

POE::Component::IRC and CTCP

by z0d (Hermit)
on May 05, 2001 at 21:30 UTC ( [id://78258]=perlquestion: print w/replies, xml ) Need Help??

z0d has asked for the wisdom of the Perl Monks concerning the following question:

Recently I wrote a simple IRC client with POE::Component::IRC. I fixed the bugs in my client I've found. One day when I was testing it again, it died with "Badly formed CTCP message...". I looked into the module and found the answer:
($name, $args) = $_ =~ /^(\w+)(?: (.*))?/ or die "Badly formed CTCP message: \"$_\""; I spend some minutes to decide whether the modul needs that die or not. Finally I found that it isn't the way it should work. It makes Your client buggy. When some bad guy sends You an illegal CTCP, Your client dies immediately.

My questions are the following:

- do You think that "die" is important here?
- how can I prevent that to trigger? (I don't want to hack the module source)


<-- z0d -->

Replies are listed 'Best First'.
Re: POE::Component::IRC and CTCP
by AgentM (Curate) on May 05, 2001 at 21:38 UTC
    The optimal case would be to hack the module source and submit a patch. I'm not familiar with the function, but perhaps it should return "false" or some other value to suggest that the function received bad information. If that is impractical or the function must perform some other important tasks, then I suggest setting a flag and returning that when the time comes. Since you specifically mention that you don't want to change the source, simply setup to catch the die like this
    $SIG{__DIE__}=sub{warn 'Illegal ping received!';}
    or something similar before the actual function call. See perlvar for more details on catching signals.
    AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.
      POE has a state in which You can catch 'die's. $SIG{__DIE__} is not what I want, because it will return after the die. I'd use an eval block.

      Anyway thanks for the answer, I mailed the bug to the author.

      <-- z0d -->

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://78258]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-25 19:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found