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

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Fellow Monks,
  &nsbp I am sure that there is a better way to do what I am trying to do. I am writing a script that allows people to input an IP from our call center and do simple tests. Forward and Reverse NS Lookup, Ping, and the killer, Traceroute. Pretty simple stuff, but the traceroute is killing me. I am on sunOS 5.7, and the traceroute binary I have running does not seem to have a way to die. Basically, if someone puts in a bad a ip, ie it will get to the gateway and just hang. Currently I work around this by
$fork = fork(); if(fork){ sleep 20; open (MYFILE, "traceroute$time.txt"); @data = <MYFILE>; if (!@data){ $error = 'Ip could not be Tracerouted'; push (@lines, $error); }else{ foreach $line (@data) { $line =~ s/\n/<br>/g; push (@lines, $line); } } }else{ $tracert = `traceroute "$ip" > traceroute$time.txt`; }
A simple, yet archaic answer to an issue that I know can be solved more easily. I was thinking about just using a system() call, sleeping, then checking it to see if I got results, but that would really not speed things up much. Please help me to find a better way!

"Never underestimate the predicability of stupidity"
- Bullet Tooth Tony, Snatch (2001)

In reply to A better way to test network elements by tradez

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others rifling through the Monastery: (4)
    As of 2018-07-15 23:20 GMT
    Find Nodes?
      Voting Booth?
      It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

      Results (327 votes). Check out past polls.