Leser: 28
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
#!/usr/bin/perl # Parser einbinden my $osmolt_file = $ARGV[0]; my $result_file = "newfile.txt"; InitFilter(); # Filter anlegen sub InitFilter { #Filterdatei oeffnen open( FH, $osmolt_file ) or die( "$osmolt_file: $!" ); open ($out, ">", $result_file) || die ("Can't open html output file: ".$result_file) ; my $count = 0; #fuer jede Zeile while( <FH> ) { chomp; # Newlines loeschen s/^\s+//; # fuehrende Leerzeichen entfernen s/\s+$//; # nachfolgende Leerzeichen entfernen next if( /^#/ ); # Kommentare ueberspringen next if( /^s*$/ ); # Leerzeilen ueberspringen #Zeile auftrennen my($point,$title,$collection_times,$icon,$icon_size,$iconOffset) = split( /\t/, $_, 7 ); if (length $desc > 0 ) { my $code = "<table width=\"100\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">"; $icon="postbox_collection.png"; CreateCollectionTimeTable(); $collection_times=$code; } print $out $point."\t".$title."\t".$collection_times."\t".$icon."\t".$icon_size."\t".$iconOffset."\n"; #Anzahl der eingelesenen Zeilen $count++; } close( FH ); close $out; print $count." Zeilen bearbeitet"; } #erstellen der Tabelle mit den Leerungszeiten sub CreateCollectionTimeTable { my(@days) = split( /;/, $collection_times ); foreach $day (@days){ $_ = $day; s/^\s+//; # fuehrende Leerzeichen entfernen s/\s+$//; # nachfolgende Leerzeichen entfernen my($dayname,$daytime) = split( / /, $_ ); $code .= "<tr><td>".$dayname."</td><td>".$daytime."</td></tr>"; print "|".$dayname."| - |".$daytime."|\n"; $code .= "</tr>"; } #Tabellen-Abschluss $code .= "</table>"; print "------------------------\n"; print $code."\n"; }
Quotepoint title description icon iconSize iconOffset
7160451.207101509,1147705.0185860004 Postkasten post_box.png 20,20 -10,-10
7157683.521090686,1145544.0289712767 Postkasten post_box.png 20,20 -10,-10
7157224.351292516,1145574.0852337866 Postkasten post_box.png 20,20 -10,-10
7156392.074875539,1147935.8952098733 Postkasten post_box.png 20,20 -10,-10
7150617.771846423,1145853.7977182642 Postkasten post_box.png 20,20 -10,-10
7153581.720383347,1171427.402445828 Postkasten post_box.png 20,20 -10,-10
7148605.16611688,1172264.7810513058 Postkasten post_box.png 20,20 -10,-10
7133011.067517117,1143746.263723012 Postkasten Mo-Fr 17:00; Sa 10:00 postbox_collection.png 20,20 -10,-10
if (length $desc > 0 )
QuoteD:\DATEN\JAN\openstreetmap\Perl_4osm\postkasten>perl post.pl postkasten.txt
"my" variable $icon masks earlier declaration in same scope at post.pl line 41.
"my" variable $collection_times masks earlier declaration in same scope at post.
pl line 42.
"my" variable $collection_times masks earlier declaration in same scope at post.
pl line 43.
Quotesyntax error at post.pl line 38, near ")
{"
syntax error at post.pl line 45, near "}else"
QuoteGlobal symbol "$out" requires explicit package name at post.pl line 51.
Global symbol "$point" requires explicit package name at post.pl line 51.
Global symbol "$title" requires explicit package name at post.pl line 51.
Global symbol "$desc" requires explicit package name at post.pl line 51.
Global symbol "$icon" requires explicit package name at post.pl line 51.
Global symbol "$icon_size" requires explicit package name at post.pl line 51.
Global symbol "$iconOffset" requires explicit package name at post.pl line 51.
Global symbol "$count" requires explicit package name at post.pl line 53.
syntax error at post.pl line 55, near "}"
post.pl has too many errors.
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
#!/usr/bin/perl use strict; use warnings; # Parser einbinden my $osmolt_file = $ARGV[0]; my $result_file = "newfile.txt"; my $count_postboxes = 0; my $count_ctimes = 0; InitFilter(); # Filter anlegen sub InitFilter { #Filterdatei oeffnen open( FH, $osmolt_file ) or die( "$osmolt_file: $!" ); open (my $out, ">", $result_file) || die ("Can't open html output file: ".$result_file) ; my $count = 0; my $desc = ""; #fuer jede Zeile while( <FH> ) { chomp; # Newlines loeschen s/^\s+//; # fuehrende Leerzeichen entfernen s/\s+$//; # nachfolgende Leerzeichen entfernen next if( /^#/ ); # Kommentare ueberspringen next if( /^s*$/ ); # Leerzeilen ueberspringen #Zeile auftrennen my($point,$title,$collection_times,$icon,$icon_size,$iconOffset) = split( /\t/, $_, 7 ); $count_postboxes##; if (length $collection_times > 0 ) { my $code = "<table width=\"100\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">"; $icon = "postbox_collection.png"; CreateCollectionTimeTable($collection_times); $desc=$collection_times; $count_ctimes++; }else{ $desc="<i>keine Leerungszeiten vorliegend!</i>"; } print $out $point."\t".$title."\t".$desc."\t".$icon."\t".$icon_size."\t".$iconOffset."\n"; #Anzahl der eingelesenen Zeilen $count++; } close( FH ); close $out; print $count." Zeilen bearbeitet"; print $count_postboxes." Postkaesten"; my $prozent_collection = 100 / $count_postboxes * $collection_times; print $collection_times." mit Leerungszeiten (".$prozent_collection.")"; } #erstellen der Tabelle mit den Leerungszeiten sub CreateCollectionTimeTable { my $ctimes = shift ; my(@days) = split( /;/, $ctimes ); foreach my $day (@days){ $_ = $day; s/^\s+//; # fuehrende Leerzeichen entfernen s/\s+$//; # nachfolgende Leerzeichen entfernen my($dayname,$daytime) = split( / /, $_ ); $code .= "<tr><td>".$dayname."</td><td>".$daytime."</td></tr>"; print "|".$dayname."| - |".$daytime."|\n"; $code .= "</tr>"; } #Tabellen-Abschluss $code .= "</table>"; print "------------------------\n"; print $code."\n";
$count_postboxes++;