Version comparison in Perl

Julien ÉLIE julien at trigofacile.com
Wed Sep 14 20:24:24 UTC 2016


The Doctor,

There is in your logs posted to can.canet.stats:

> Argument "0.33_01" isn't numeric in numeric lt (<) at /var/news/bin/controlchan line 73.

Do you use an official release of Perl or a development one?

Anyway, we are using the following code in a few Perl scripts:

if ($use_syslog) {
    if ($Sys::Syslog::VERSION < 0.15) {
        eval "sub Sys::Syslog::_PATH_LOG { '/dev/log' }" if $^O eq 'dec_osf';
        Sys::Syslog::setlogsock('unix') if $^O =~ /linux|dec_osf|freebsd|darwin/;
    }
    openlog('controlchan', 'pid', $INN::Config::syslog_facility);
}


Unfortunately, version.pm which would allow to use:
  version->parse("$Sys::Syslog::VERSION") < version->parse("0.15")
is not present in Perl 5.8.0 (it was introduced in Perl 5.9.0).

I do not think we should drop Perl 5.8.0 compatibility because of that
(Perl 5.10.0 is "fairly" recent).

Does anybody know a proper way to compare module versions in Perl?
I had in mind just taking the part before "_" and go on comparing
the numbers, but it is not very satisfying...




I also see:

> Sep 13 10:22:18 gallifrey overchan[98765]: input line too long, skipping

Do you know what causes that, The Doctor?
And do you really need overchan?



> expireover: OVDB: expiregroup: recounting ab.politics
> expireover: OVDB: expiregroup: recounting abg.test04
> expireover: OVDB: expiregroup: recounting aioe.test
> expireover: OVDB: expiregroup: recounting airnews.general
> expireover: OVDB: expiregroup: recounting alabama.birmingham.students
> expireover: OVDB: expiregroup: recounting alabama.politics
> expireover: OVDB: expiregroup: recounting alabama.test
> expireover: OVDB: expiregroup: recounting alt.12hr
> expireover: OVDB: expiregroup: recounting alt.12step.cuckold.jaime-de-castellvi
> expireover: OVDB: expiregroup: recounting alt.abortion
[...]

There are tons of similar lines at the end of your Usenet daily report.
I believe they should not be there.  I'll have a look to see why
they end up in the daily report.

-- 
Julien ÉLIE

« Nigro notanda lapillo. » (Catulle)


More information about the inn-workers mailing list