Dennis Peterson wrote the following on 9/25/2007 8:06 PM -0800:
> Bill Landry wrote:
>
>   
>> Okay, let's try this again.  A new update has been posted that will first try
>> "date +%s" and if that fails, then it will automatically fall back to a perl
>> option.  I didn't update the version number, just the version info:
>>     
>
> You can rip out a lot of code (well, some code) if you just use the Perl 
> date method by default and forget the date +%s stuff entirely. You 
> already have a dependency on Perl so there's no point adding another 
> tool check to see if gnu date is present as it isn't needed. It's a KISS 
> thing.
>   

Yeah, but if you check, you will see that perl is always used as a
secondary solution, so perl may never be called when the script is run. 
Besides, there may be systems that do not have perl installed (unlikely,
but possible).  And I've noticed that shelling out to perl is very slow
compared to the primary options:

time echo PING | socat - /var/amavis/clamd.sock
PONG

real    0m0.003s
user    0m0.001s
sys     0m0.002s
-----
time perl -MIO::Socket::UNIX -we '$s = IO::Socket::UNIX->new(shift);
$s->print("PING"); print $s->getline; $s->close' /var/amavis/clamd.sock
2> /dev/null
PONG

real    0m0.040s
user    0m0.035s
sys     0m0.006s

If I were proficient in perl, I would have rather written the entire
script in perl (maybe time to break open my perl book).  Anyway,
hopefully it is generic enough now, with the fall-back options, that it
will not need much more editing.

> And nice script, too.
>   

Thanks!

Bill
_______________________________________________
Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net
http://lurker.clamav.net/list/clamav-users.html

Reply via email to