DOIF Perl unwanted replacement of [+-] with ::DOIF_time_once()

Begonnen von Nestor, 31 Dezember 2020, 13:29:09

Vorheriges Thema - Nächstes Thema

Nestor

I have the following code in the middle a DOIF Perl condition:
$alias =~ s/[+-][\d.]+\s//;
which gets replaced with
$alias =~ s/[::DOIF_time_once($hash,3,$wday)][\d.]+\s//;
which is nonsensical.

Simple fix for now:
my $prefix = '+-';
$alias =~ s/[${prefix}][\d.]+\s//;


Should DOIF Perl just check the first line of the condition for timer syntax instead of replacing it in the whole function?

Damian

Zitat von: Nestor am 31 Dezember 2020, 13:29:09
I have the following code in the middle a DOIF Perl condition:
$alias =~ s/[+-][\d.]+\s//;
which gets replaced with
$alias =~ s/[::DOIF_time_once($hash,3,$wday)][\d.]+\s//;
which is nonsensical.

Simple fix for now:
my $prefix = '+-';
$alias =~ s/[${prefix}][\d.]+\s//;


Should DOIF Perl just check the first line of the condition for timer syntax instead of replacing it in the whole function?

Time triggers may occur anywhere within a Perl block. It is incorrectly recognized as a time trigger. I would have to further restrict the time trigger check. Outsourcing to a function in the subs block would also help.
Programmierte FHEM-Module: DOIF-FHEM, DOIF-Perl, DOIF-uiTable, THRESHOLD, FHEM-Befehl: IF