Discipulus has asked for the wisdom of the Perl Monks concerning the following question:
now I want for the every entry that match I want some bottons to do stuff for example to ping this hostname and verify if it pings on the machine where it resides.. and others command that can run on the server.. and here start my problem..#$cosa is the first parameter of the request while (<LOGFILE>) { push(@logline, $_); } ... foreach $record(@logline) { my @ciccio=split/\?/,$record; pop @ciccio; if ($ciccio[2]=~/$cosa/ || $ciccio[3]=~/$cosa/ || $ciccio[14]=~/$co +sa/ ) { $indice++; print table({-border=>0,-width=>"100%", -cellspacing=>"0", -cellpa +dding=>"0"}, Tr({-align=>LEFT,-valign=>TOP}, [ td([$q->h5("$indice)"),"$ciccio[0]","poiiiii $risultato_pin +g"]), td([$q->a({-href=>"http://$ciccio[2]",target=>new},"$ciccio +[2]"),"$ciccio[4]"]), td(["$ciccio[3]","$ciccio[7]"]), td(['',"$ciccio[9]"]), td(['',"$ciccio[10]"]), td(['',"$ciccio[11]"]), td(['',"$ciccio[14]"]), td(['',"$ciccio[15]"]), td([''," "]) ] ) );
ID EST: I search for www.perl.it ... I find it out and I print a breakline, the table of results where the www.perl.it is a link to the site (until now all good..)then it appears a beatiful botton named PING and I want that if you click it in the table will appears in the first row at the third place the IP of the host ..print $q->start_form(-method=>'POST',-action=>'formDB.cgi'); print $q->hidden(-name=>'ping',-value=>"$ciccio[2]"); print $q->submit('PING'); print $q->hr; } } } #... if (defined ($pingalo = $q->param('ping'))) { open (FH,"ping -n 1 -l 1 $pingalo|"); while (<FH>){if ($_=~/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/){$risult +ato_ping=$1}} close FH; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI command newbie question
by benn (Vicar) on Aug 07, 2003 at 14:22 UTC |