Uhm, try:
#!/usr/bin/perl -w
use strict; # (because you should!)
$| = 1;
while (<>) {
chomp;
my ($ip) = $_;
# XXX should verify IP is an IP and not something nasty!
...
}
The question then is how to query a cgi from a helper. I'd try the LWP stuff
in Perl to talk to a cgi-bin ; what you've doen there is try to read a file,
not call a cgi-bin. :)
Adrian
On Wed, Mar 05, 2008, Dave Coventry wrote:
> Thanks, Mick.
>
> On Wed, Mar 5, 2008 at 12:08 PM, Michael Graham wrote:
> > (Sorry Dave I keep hitting reply and not reply to list)
> Yes, I keep doing that :)
>
> > External helps are not supposed to exit once they have completed a
> > request. Your perl script should read from stdin then write OK/ERR then
> > wait for more input.
> Ah!
>
> So this should work?
>
> 1:#!/usr/bin/perl
> 2:while(1){
> 3: $| = 1;
> 4: $ip=<STDIN>;
> 5: $ip=chomp($ip);
> 6: $ipfile='/var/www/apache2-default/cgi-bin/ips/'.$ip;
> 7: #print $ipfile;
> 8: if (-e $ipfile){print "OK";}
> 9: else {print "ERR : ".$ip;}
> 10:}
>
> I'll try it right now.
-- - Xenion - http://www.xenion.com.au/ - VPS Hosting - Commercial Squid Support - - $25/pm entry-level VPSes w/ capped bandwidth charges available in WA -Received on Wed Mar 05 2008 - 04:17:16 MST
This archive was generated by hypermail pre-2.1.9 : Tue Apr 01 2008 - 13:00:04 MDT