I am trying to convert a BASH script to perl as it is getting too complicated to manage in bash. The script is basically a menu to choose one of seven snmp commands to run against one of 761 remote elements in the network segment I am responsible for. The problem I have is that on of the snmpget command strings will "hang" during the communication proccess with any given elements. THe snmpget command places the N.E. (network element) into an administrative state of "inTest" which is returned to "enabled" upon sucessfull completion. If the proccess hangs with the script I have now, I have to ^C and choose the snmpset command to reenable this NE. in bash, I have used \trap 're-enable' 2\ to send the script to the re-enable procedure on ^C. This will only work once then any subsiquent ^C only interrupt the script echoing "^C" to the tty and I have to exit and rerun the script. I want to be able to monitor the output and if there is no output from the command on line #4 (all data is tee'd to a NE specific logfile overwritten when the procedure is executed) after 10 seconds then the script will return either to the main-menu procedure, or go straight to the re-enable procedure. Unfortunatly most of the script contains propriatary information and I can not put the actual bash script here due to the IP and NonDisclose I signed. in a nut shell I use:
#!/usr/bin/bash re-enable () { commands here to re-enable the NE echo -n "Press ENTER to continue" ; read a main-menu } check-NE () { trap 're-enable' 2 command series that hangs echo -n "Press ENTER to continue" ; read a main-menu } main-menu () { choices with read a case $a 1) re-enable;; 2) check-NE;; .. 8 case statements *) exit;; } main-menu
I am a perl neophite and can hardly get hello world to work right =) but I can fudge through everything except the monitor output, if no output in 10 seconds auto sigint and return to script sub-procedure. any help / advice is appreciated.

In reply to Help with SIGINT by dmcdougald

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.