Thread Bareword Problem (1 answers)
Opened by raspklaus at 2016-02-14 11:16

raspklaus
 2016-02-14 11:16
#183875 #183875
User since
2015-10-26
5 Artikel
BenutzerIn
[default_avatar]
Hallo zusammen,

ich verwende folgende Funktion um eingelesene Strings auszuwerten:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
RemovalCheck {
my $RemovalBlack = "off";
my $RemovalBrown = "off";
my $RemovalBlue = "off";
my $RemovalYellow = "off";
my $RemovalToxic = "off";
my $RemovalPaper = "off";
my $RemovalGreen = "off";

my $rcal= fhem("get Abfall text all 4");
my @events = split ("\n", $rcal);
my $tomorrow = strftime "%d.%m.%y", localtime(time + 86400);

foreach my $event (@events)
{
my @values = split(" ", $event);

if ($values[0] eq $tomorrow)
{
if ($values[3] eq "Restmüll") {$RemovalBlack = "on"}
elsif ($values[3] eq "Biomüllabfuhr") {$RemovalBrown = "on"}
elsif ($values[3] eq "Papiertonne") {$RemovalBlue = "on"}
elsif ($values[3] eq "Gelber") {$RemovalYellow = "on"}
elsif ($values[3] eq "Schadstoffsammlung") {$RemovalToxic = "on"}
elsif ($values[3] eq "Papiersammlung") {$RemovalPaper = "on"}
elsif ($values[3] eq "Grünabfallsammlung") {$RemovalGreen = "on"}
}
}
fhem("set RemovalBlack $RemovalBlack");
fhem("set RemovalBrown $RemovalBrown");
fhem("set RemovalBlue $RemovalBlue");
fhem("set RemovalYellow $RemovalYellow");
fhem("set RemovalToxic $RemovalToxic");
fhem("set RemovalPaper $RemovalPaper");
fhem("set RemovalGreen $RemovalGreen");
return;
}


Mit get Abfall text next 4 werden auch die benötigten Strings richtig eingelesen:

Code: (dl )
1
2
3
4
15.02.16 06:00 Abfuhrtermin Biomüllabfuhr am 15.02.2016 
22.02.16 06:00 Abfuhrtermin Restmüll am 22.02.2016
23.02.16 06:00 Abfuhrtermin Papiertonne am 23.02.2016
29.02.16 06:00 Abfuhrtermin Biomüllabfuhr am 29.02.2016


Doch bei der Auswertung bekomme ich folgende Fehler:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2016.02.14 10:14:50 3: RemovalCheck return value: No such class RemovalCheckevents at (eval 29356) line 11, near ";
my RemovalCheckevents"
syntax error at (eval 29356) line 11, near "my RemovalCheckevents ="
No such class RemovalCheckvalues at (eval 29356) line 16, near "{
my RemovalCheckvalues"
syntax error at (eval 29356) line 16, near "my RemovalCheckvalues ="
Global symbol "@values" requires explicit package name at (eval 29356) line 18.
Global symbol "@values" requires explicit package name at (eval 29356) line 20.
Global symbol "@values" requires explicit package name at (eval 29356) line 21.
Global symbol "@values" requires explicit package name at (eval 29356) line 22.
Global symbol "@values" requires explicit package name at (eval 29356) line 23.
Global symbol "@values" requires explicit package name at (eval 29356) line 24.
Global symbol "@values" requires explicit package name at (eval 29356) line 25.
Global symbol "@values" requires explicit package name at (eval 29356) line 26.
Bareword "RemovalCheckevents" not allowed while "strict subs" in use at (eval 29356) line 14.


Wie kann ich das bereinigen. Habe den Code übernommen und bin blutiger Anfänger. Bitte Euch um Hilfe

View full thread Bareword Problem