Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Calling and catching a trigger

by shayak (Novice)
on Jun 20, 2011 at 14:55 UTC ( #910580=perlquestion: print w/replies, xml ) Need Help??
shayak has asked for the wisdom of the Perl Monks concerning the following question:

Their are two scripts and; is called by; Now when is running and if it encounters a condition, i want to trigger an alarm to; Now when the trigger is called executes a function. In the meantime keeps on running and keeps on sending triggers wherever required without stopping. And runs the particular functions for the triggers. How to do this? Another info. is in the host machine and is in a VM. I want to know exactly how can we give the trigger(alarm)from and catch it with the main script

Replies are listed 'Best First'.
Re: Calling and catching a trigger
by Anonymous Monk on Jun 20, 2011 at 14:59 UTC
    Remember all those GUI automation questions you had? All they're doing is sending messages (its like signals) to programs.

    You can do this too.

      I want to know how can i do it when the script is continuosly running?
        Whether or not the script is continuously running, makes no difference.
Re: Calling and catching a trigger
by NetWallah (Abbot) on Jun 21, 2011 at 05:25 UTC
    What you are attempting sounds a lot like an SNMP Trap send and receive system.

    Configure snmpd to receive the trap, and call your ''.

    When you need to send the trap, have your '' call snmptrap to send it.

    Much complexity, features and cruft can be added, once the basic system starts working.

                "XML is like violence: if it doesn't solve your problem, use more."

Re: Calling and catching a trigger
by aquarium (Curate) on Jun 21, 2011 at 04:43 UTC
    that sort of architecture is typically but not always quite messy. instead design a third program, which has a proper interface to be a controller of sorts. that way you can get some sanity
    the hardest line to type correctly is: stty erase ^H

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://910580]
Approved by Corion
[1nickt]: pryrt I guess I don;t really care if user 42 logs on as 42.0 ... more of an academic question at this point.
[LanX]: jdporter: open PIPE,'-|' ?
[LanX]: oh you want the result line by line?
[jdporter]: ok, LanX, then what?
[jdporter]: It doesn't have to be line by line. Just "my program" "writes" to the external prog and also/then "reads" from it.
LanX open (You are not allowed to open to a command that pipes both in and out, but see IPC::Open2, IPC::Open3, and Bidirectional Communication with Another Process in perlipc for alternatives.)
[jdporter]: IPC::Open2, I guess
[jdporter]: yes, that

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (13)
As of 2017-05-24 20:31 GMT
Find Nodes?
    Voting Booth?