On Wed, 07 Sep 2022 16:59:17 -0700, Nye Liu wrote: > munin-graph does not seem to use Date::Manip at all, unless there is a > hidden dependency that isn't obvious.
This also causes munin's autopkgtests to fail which blocks
libdate-manip-perl from migrating to testing.
Now it can be argued that Date::Manip sending warnings to STDERR is
not so clever but the old v5 interface _will_ be removed [0] so
munin has to do something at some point.
Originally I shared the impression that munin doesn't actively use
Date::Manip in the end:
% grep -ri Date::Manip
master/_bin/munin-cgi-graph.in: $Date::Manip::Backend = 'DM5';
master/_bin/munin-cgi-graph.in:use Date::Manip;
master/_bin/munin-graph.in: # This is needed because Date::Manip has
deprecated the functional
master/_bin/munin-graph.in: $Date::Manip::Backend = 'DM5';
master/_bin/munin-graph.in: $Date::Manip::Backend = 'DM5';
master/_bin/munin-graph.in:use Date::Manip;
ChangeLog: Force usage of the DM5 Date::Manip backend
Looking at Date::Manip::Migration5to6(3pm): This document talks about
Date_Init(), Date_ConvTZ(), etc., and I don't find these two
functions anywhere in munin.
But, reading Date::Manip::DM5(3pm) and grepping a bit there's e.g.:
% grep -r ParseDateString
master/_bin/munin-cgi-graph.in: my $ifmodsec = &UnixDate (&ParseDateString
($since_string), "%s");
master/_bin/munin-graph.in: my $ifmodsec = &UnixDate (&ParseDateString
($since_string), "%s");
Not sure if other functions than ParseDateString and UnixDate are
used somewhere … At least those 2 should work the same with the
Date::Manip::DM6 backend.
Contrary to the comment in the code, v6 _has_ a functional
interface; cf. Date::Manip::Interfaces(3pm)). Which is not
deprecated. And:
From Date::Manip::Interfaces(3pm):
Use the default functional interface
By including:
use Date::Manip;
in your script, one of the functional interfaces will be
loaded. If you are running a version of perl older than 5.10,
it will automatically be the version 5 interface. If you are
running a newer version of perl, it will automatically load
the version 6 interface.
So something like
#v+
--- a/master/_bin/munin-cgi-graph.in
+++ b/master/_bin/munin-cgi-graph.in
@@ -25,10 +25,6 @@
use strict;
use warnings;
use IO::Handle;
-BEGIN {
- no warnings;
- $Date::Manip::Backend = 'DM5';
-}
use Date::Manip;
use POSIX qw(strftime locale_h);
use CGI::Fast qw(:cgi);
--- a/master/_bin/munin-graph.in
+++ b/master/_bin/munin-graph.in
@@ -32,15 +32,6 @@
use warnings;
use IO::Handle;
-BEGIN {
- # This is needed because Date::Manip has deprecated the functional
- # interface in >= 6.x. So, we force the use of the 5.x API.
- $Date::Manip::Backend = 'DM5';
-
- # Double line here to avoid spurious warnings about D::M::Backend being
- # used only once.
- $Date::Manip::Backend = 'DM5';
-}
use Date::Manip;
use POSIX qw(strftime);
use Time::HiRes qw(gettimeofday tv_interval);
#v-
might be enough.
Cheers,
gregor
[0] from Changes6.pod:
#=head1 VERSION 7.00 (expected 2024-12-01)
# Remove DM5
--
.''`. https://info.comodo.priv.at -- Debian Developer https://www.debian.org
: :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D 85FA BB3A 6801 8649 AA06
`. `' Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe
`-
signature.asc
Description: Digital Signature

