On Fri, Apr 07, 2000 at 11:01:59AM -0700, Karyn Ulriksen wrote:
> One of the reasons that I always like the nph- construction is that is
> showed the traceroute 'live' like it would from a console.  Last I checked
> perl doesn't show the traceroute result until the sessions complete which
> could be a long time if there is trouble in the trace.  Did you find a way
> to get past that?  

This works for me, showing the results as they come, under Apache::Registry.

my $r = shift;
$r->content_type('text/html');
$r->send_http_header;
...
$|=1;
if (open (FILE, "/usr/sbin/traceroute $host 2>&1 |")) {
    print while <FILE>;
    close FILE;
}

I think there's a Net::Traceroute on CPAN, might want to check that out to
avoid the fork.

--
Eric


> 
> -----Original Message-----
> From: Sam Carleton [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 07, 2000 7:18 AM
> To: mod_perl Mailing List
> Subject: Re: best way to call traceroute
> 
> 
> Steven Champeon wrote:
> 
> > On Fri, 7 Apr 2000, Sam Carleton wrote:
> > > I want to call traceroute to the remote_host from within a mod_perl
> > > script, being a C/C++ programmer I don't the best way to do that.  Is
> > > there a traceroute object I could use?  If so, how?  Otherwise how do I
> > > run traceroute from within a perl script?
> >
> > I'm getting ready to port an old and somewhat clunky traceroute CGI script
> > to mod_perl, mostly to avoid the horrid 'nph-' construction. If you'd like
> > I can make the source available.
> 
> That would be great!  Any idea when it will be ready?
> 
> Sam
> 

-- 
Eric Cholet

Reply via email to