FHEM Forum

FHEM => Sonstiges => Thema gestartet von: Nestor am 29 Oktober 2025, 20:47:40

Titel: 98_Modbus.pm Small patch for WARNING under perl-5.42.0
Beitrag von: Nestor am 29 Oktober 2025, 20:47:40
Following changed in Perl 5.40:
https://perldoc.perl.org/5.40.0/perldelta#Calling-the-import-method-of-an-unknown-package-produces-a-warning

Which gives following error when starting Fhem under Perl 5.42 (latest stable):
PERL WARNING: Attempt to call undefined import method with arguments (":all") via package "SetExtensions" (Perhaps you forgot to load the package?) at ./FHEM/98_Modbus.pm line 180, <$fh> line 139.
PERL WARNING: Attempt to call undefined import method with arguments (":all") via package "TcpServerUtils" (Perhaps you forgot to load the package?) at ./FHEM/98_Modbus.pm line 185, <$fh> line 139.

Since there is no class in SetExtensions.pm or TcpServerUtils.pm, nothing can be imported, just the file included so the functions are available.

Small patch (backwards compatible):
--- -    2025-10-01 18:51:57.718221081 +0200
+++ /srv/fhem/FHEM/98_Modbus.pm    2025-09-30 18:36:53.000000000 +0200
@@ -177,12 +177,12 @@
 use strict;
 use warnings;
 use GPUtils         qw(:all);
-use SetExtensions   qw(:all);
+use SetExtensions;
 use Time::HiRes     qw(gettimeofday tv_interval sleep);     # work with floats, not just full seconds
 use POSIX           qw(strftime);
 use Encode          qw(decode encode);
 use Scalar::Util    qw(looks_like_number);
-use TcpServerUtils  qw(:all);
+use TcpServerUtils;
 use DevIo;
 use FHEM::HTTPMOD::Utils qw(:all);
 use Scalar::Util qw(weaken);                # needed for backlinks in queue structures (see chapter 11 in PBP / memory leak reported with relays)