Hallo,
da mein Skript nun schon sehr umfangreich geworden ist, bin ich nun wieder bei gegangen, den code zu kommentieren. Und was passiert? Mein Perl-Skript streikt. Ich konnte nun eine Stelle isolieren, bei der das Problem auftritt.
Code:
# function to read the module files
sub readmods
{
# directory, where to find the modules
my $hidefimods="$hidefiroot/etc/hidefi/modules/";
# store filenames in this directory to an array
my @files=`ls -1 $hidefimods`;
# process all files
foreach $file (@files)
{
# remove spaces, i don't really know why this is needed, but it is...
$file=~s/\s+//g;
# variable to store the whole module (we'll proceed as already done with the configuration file)
my $wholemod="";
# open module file
open(MOD,"<$hidefimods/$file") || die "Cant read $hidefimods/$file\n";
# store its lines to an array
my @modlines=<MOD>;
foreach my $modline (@modlines)
{
# if this line contains characters and begins not with an
if ($modline =~ /\w/ && $modline !~ /^\s*#/)
{
Die funktion geht noch viel weiter... das lasse ich mal weg. Tatsache ist, das die so eingeleitete Funktion nicht läuft. Ich bekomme die Mitteilung, das es sich um ein falsche switch-Statement handelt. switch benutze ich das letzte Mal etwa 250 Zeilen, vor der, die in der Fehlerangabe gemeldet wird , also auch in einer anderen Subroutine.
Entferne ich die Kommentare auf dem Bereich, funktioniert alles...
... das kann doch nicht angehen!
Lesezeichen