mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
AttrTemplate.pm: add checkPar and some more deteiledd error msg (Forum #108999)
git-svn-id: https://svn.fhem.de/fhem/trunk@21408 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
b54abc0692
commit
baeb2c738a
@ -211,6 +211,23 @@ AttrTemplate_Set($$@)
|
||||
return join("\n", @hlp);
|
||||
}
|
||||
|
||||
if($entry eq "checkPar") {
|
||||
my @ret;
|
||||
foreach $entry (sort keys %templates) {
|
||||
my $h = $templates{$entry};
|
||||
for my $k (@{$h->{pars}}) {
|
||||
my ($parname, $comment, $perl_code) = split(";",$k,3);
|
||||
nex if(!$perl_code);
|
||||
$perl_code =~ s/(?<!\\)DEVICE/bla/g;
|
||||
$perl_code =~ s/\\DEVICE/DEVICE/g;
|
||||
my $ret = eval $perl_code;
|
||||
push @ret,"$entry:$parname:$@" if($@);
|
||||
}
|
||||
}
|
||||
return "No errors found" if (!@ret);
|
||||
return join("\n", @ret);
|
||||
}
|
||||
|
||||
my $h = $templates{$entry};
|
||||
return "Unknown template_entry_name $entry" if(!$h);
|
||||
|
||||
@ -245,7 +262,8 @@ AttrTemplate_Set($$@)
|
||||
$perl_code =~ s/(?<!\\)DEVICE/$name/g;
|
||||
$perl_code =~ s/\\DEVICE/DEVICE/g;
|
||||
my $ret = eval $perl_code;
|
||||
return "Error checking template regexp: $@" if($@);
|
||||
return "ERROR executing perl-code $perl_code for param $parname: $@ "
|
||||
if($@);
|
||||
if(defined($ret)) {
|
||||
$repl{$parname} = $ret;
|
||||
next;
|
||||
|
Loading…
Reference in New Issue
Block a user