Leser: 20
QuoteUse of uninitialized value $_ in pattern match (m//) at OSM/osm.pm line 139, <$file> line 11.
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
sub openOsmFile {
$fileName = shift ;
if (grep /.bz2/, $fileName) { $isBz2 = 1 ; } else { $isBz2 = 0 ; }
if ($isBz2) {
$bz = bzopen($fileName, "rb") or die "Cannot open $fileName: $bzerrno\n" ;
}
else {
open ($file, "<", $fileName) || die "can't open osm file" ;
}
nextLine() ;
while ( ! (grep /node/, $line) ) {
nextLine() ; #<<<---- Zeile 139
}
return 1 ;
}
...
sub nextLine {
if ($isBz2) {
$bz->bzreadline($line) ;
}
else {
$line = <$file> ;
}
}
Quote<?xml version='1.0' encoding='UTF-8'?>
<osm version="0.5" generator="Osmosis 0.29">
<bound box="35.99000,-5.70000,36.90000,-3.80000" origin="http://www.openstreetmap.org/api/0.5"/>
<node id="10914525" timestamp="2006-07-18T14:29:07Z" user="Nickb" lat="36.4274101" lon="-5.6876476">
<tag k="created_by" v="JOSM"/>
</node>
<node id="10914526" timestamp="2006-07-18T14:29:07Z" user="Nickb" lat="36.4192174" lon="-5.6742741">
<tag k="created_by" v="JOSM"/>
</node>
<node id="10914527" timestamp="2006-07-18T14:29:07Z" user="Nickb" lat="36.4145789" lon="-5.6633103">
<tag k="created_by" v="JOSM"/>
</node>
<node id="10914530" timestamp="2006-07-18T14:29:07Z" user="Nickb" lat="36.4105978" lon="-5.6590398">
<tag k="created_by" v="JOSM"/>
</node>
<node id="10914531" timestamp="2006-07-18T14:29:07Z" user="Nickb" lat="36.4054762" lon="-5.6561667">
<tag k="created_by" v="JOSM"/>
</node>
<node id="10914532" timestamp="2006-07-18T14:29:07Z" user="Nickb" lat="36.4012291" lon="-5.6559169">
<tag k="created_by" v="JOSM"/>
1 2 3
if (grep /.bz2/, $fileName) { $isBz2 = 1 ; } else { $isBz2 = 0 ; } ... while ( ! (grep /node/, $line) ) {
1 2 3
if ($fileName =~ /\.bz2$/) { $isBz2 = 1 ; } else { $isBz2 = 0 ; } ... while ($line =~ /node/) { ...
1 2 3
$isBz2 = ($fileName =~ /\.bz2$/) ? 1 : 0 ; ... while (index($line, 'node') >= 0) { ...
2009-04-02T11:25:39 Dubu...
Dann scheint der Autor den Match-Operator nicht zu kennen, sondern nutzt stattdessen grep(), was dafür eigentlich nicht gedacht ist:...