[Dxspider-support] Argument " " isn't numeric in int at /spider/perl/DXUtil.pm line 644

Fabian Kurz fabian at fkurz.net
Wed Apr 9 10:49:24 BST 2025


On Wed, Apr 09, 2025 at 09:06:28AM +0100, Keith, G6NHU via Dxspider-support wrote:
> Sorry, Dirk, your attempted fix didn’t work.
> 
> 07:50:01 (*) Argument " " isn't numeric in int at /spider/perl/DXUtil.pm line 645.
> 07:50:01 (*)  at /spider/perl/DXUtil.pm line 645.

This comes from spider/cmd/show/cluster.pl line 11 where the uptime is calculated:

$uptime = difft($main::starttime, ' ');

The function difft() could be changed in the following way to make
this warning disappear:

diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm
index e88f93ec..9a3b7d0e 100644
--- a/perl/DXUtil.pm
+++ b/perl/DXUtil.pm
@@ -642,7 +642,7 @@ sub difft
        $t -= $h * 3600;
        $m = int $t / 60;
        $out .= sprintf ("%s${m}m", $adds?' ':'') if  $m;
-       if (($d == 0 && $adds) || (int $adds && $adds == 2)) {
+       if (($d == 0 && $adds) || ($adds =~ /^\d+$/ && $adds == 2)) {
                $s = int $t % 60;
                $out .= sprintf ("%s${s}s", $adds?' ':'') if $s;
                $out ||= sprintf ("%s0s", $adds?' ':'');

I just deployed this on DA0BCC-7 and there are no more warnings in the log.

73
Fabian, DJ5CW
-- 
Fabian Kurz              Munich, Germany
fabian at fkurz.net         +49(174)6926713
https://fkurz.net/       DJ5CW / SO5CW



More information about the Dxspider-support mailing list