From b5280a2a14c9060fb40bd04c36518a1f1cf62d42 Mon Sep 17 00:00:00 2001 From: risiko79 <> Date: Tue, 10 Nov 2015 19:09:48 +0000 Subject: [PATCH] 10_pilight_ctrl: replace POSIX isdigit because it is deprecated git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@9843 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/10_pilight_ctrl.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/FHEM/10_pilight_ctrl.pm b/FHEM/10_pilight_ctrl.pm index 20c34bf16..050c51961 100644 --- a/FHEM/10_pilight_ctrl.pm +++ b/FHEM/10_pilight_ctrl.pm @@ -1,5 +1,5 @@ ############################################## -# $Id: 10_pilight_ctrl.pm 1.12 2015-09-11 Risiko $ +# $Id: 10_pilight_ctrl.pm 1.13 2015-11-10 Risiko $ # # Usage # @@ -37,6 +37,7 @@ # V 1.10 2015-08-30 - NEW: support pressure, windavg, winddir, windgust from weather stations and GPIO sensors # V 1.11 2015-09-06 - FIX: pressure, windavg, winddir, windgust from weather stations without temperature # V 1.12 2015-09-11 - FIX: handling ContactAsSwitch befor white list check +# V 1.13 2015-11-10 - FIX: POSIX isdigit is deprecated replaced by own isDigit ############################################## package main; @@ -68,6 +69,12 @@ my @unitList = ("unit","unitcode","programcode"); #brands arctech:kaku,... list of : protocol names #ContactAsSwitch 1234,... list of ids where contact is transformed to switch +sub isDigit($) +{ + my ($d) = @_; + return $d =~ /^\d+?$/ ? 1 : 0; +} + sub pilight_ctrl_Initialize($) { my ($hash) = @_; @@ -281,7 +288,7 @@ sub pilight_ctrl_Check($) RemoveInternalTimer($hash); - $hash->{helper}{CHECK} = 0 if (!isdigit($hash->{helper}{CHECK})); + $hash->{helper}{CHECK} = 0 if (!isDigit($hash->{helper}{CHECK})); $hash->{helper}{CHECK} +=1; Log3 $me, 5, "$me(Check): $hash->{STATE}"; @@ -392,8 +399,8 @@ sub pilight_ctrl_Write($@) my $id = $defs{$cName}->{ID}; my $unit = $defs{$cName}->{UNIT}; - $id = "\"".$id."\"" if (defined($id) && !isdigit($id)); - $unit = "\"".$unit."\"" if (defined($unit) && !isdigit($unit)); + $id = "\"".$id."\"" if (defined($id) && !isDigit($id)); + $unit = "\"".$unit."\"" if (defined($unit) && !isDigit($unit)); my $code; switch($cType){