
| Current Path : /var/www/web-klick.de/dsh/90_akt/appserv/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/web-klick.de/dsh/90_akt/appserv/csv.pl |
my $all_fields = "," . shift . ",dbl,";
my $named_fields = shift;
$named_fields =~ s/\-//gs;
$named_fields = uc($named_fields);
$ENV{'dbl'} = "";
$text1 = "";
if ($0 =~ s/(^|-)([a-zA-Z0-9]+)-/$ENV{lc($2)}/gi) {
$0 =~ s/^(.*)\/(.*)$/$2/;
open(FFILE,"<".$0); # || open(FFILE,"<".$o);
$text1 = join("",<FFILE>);
close(FFILE);
$ENV{'dbl'} = "x" if ($text1);
print "$0 generated $text1\n"; open(STDOUT,">>$0");
}
$text = "";
foreach $o (split(/,/,$named_fields)) {
$o =~ s/\-//gs;
$all_fields =~ s/,$o,/,/i;
$text = $text . $ENV{lc($o)} . ",";
}
$text = $text . "\"\n";
my $zaehler = 0;
my $maxz = 0;
foreach $o (sort split(/,/,$all_fields)) {
next if (!$o);
next if (!($ENV{lc($o)}));
$text = $text . uc($o) . ": " . $ENV{lc($o)} . "\",\"\n";
$zaehler = sprintf("%02u",$zaehler+1);
next if ($zaehler < $maxz);
$maxz = $zaehler + 1;
$named_fields = $named_fields . ",F" . $zaehler;
}
print $text . "\"\n" if ($text ne $text1); # avoiding doublettes ...
close(STDOUT);
open(FFILE,"<00header.pl"); # extend header if necessary
$text = <FFILE>;
close(FFILE);
$text =~ s/\n//s;
if (length($text) < length($named_fields)) {
open(FFILE,">00header.pl");
print FFILE $named_fields . "\n";
close(FFILE);
}