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

I am using eterm to connect to a server as an emulation. This session will receive messages from the server such as "Machine X is out of paper". When I receive that message I would like that emailed. Is there a way to do this in Perl? From what I've read Perl seems like the way to go.. Any thoughts we be greatly appreciated. Thanks

Replies are listed 'Best First'.
Re: monitor a session
by Riales (Hermit) on Feb 29, 2012 at 22:52 UTC

    Which part do you need help with? Emailing a message? Or determining that the server has sent an alert?

    For the former, I'd take a look at the Email::Send module.

    The latter depends on how the server is currently sending messages to your terminal...

      More that the Server is sending the message to the terminal. I've seen the email scripts around.
        To me, the easiest way to go about this seems to be to find whatever script is outputting the messages you want to capture and have it do the emailing instead of just printing to STDOUT. I can't think of a good way to 'listen' for an event like that in a terminal...
Re: monitor a session
by aaron_baugher (Curate) on Mar 15, 2012 at 14:29 UTC

    How are the messages sent to the terminal? Do you run a program that outputs them, or is the server sending them to all terminals with something like wall?

    The first case is simple: pipe the output of the program to a script which does what you want with the output while reprinting it verbatim to the screen. The second case (which I'm guessing fits here) is more complicated, and depends on whether you're running this eterm on the server and displaying it on your local machine, or running the eterm on your local machine and connecting to the server with something like ssh. There may also be a better way to do it.

    Aaron B.
    My Woefully Neglected Blog, where I occasionally mention Perl.