Hello.
I'm afraid I'm rather new to perl, and my understanding of it so far has been based upon a 'trial-and-error' approach, so please bear with me.

I'm trying to execute a script to extract an openstreetmap planet.osm file into a postgreSQL databse. The script calls on several modules, which I have so far managed to install without too much difficulty. However, I have stumbled across an error that I am unsure how to solve.

The error in this case relates to the planet.pm module, which uses the 'strict' pragma. When executing planetosm-to-db.pl the following error is returned:

Global symbol "$VERBOSE" requires explicit package name at /System/Lib +rary/Perl/5.8.6/darwin-thread-multi-2level/Geo/OSM/Planet.pm line 165 +. Global symbol "$DEBUG" requires explicit package name at /System/Libra +ry/Perl/5.8.6/darwin-thread-multi-2level/Geo/OSM/Planet.pm line 165.
Line 165 reads:

print STDERR "Mirror OSM Data from $url\n" if $VERBOSE || $DEBUG;

which I altered to

print STDERR "Mirror OSM Data from $url\n" if my($VERBOSE) || my($DEBUG);

resulting in more explicit package name errors – on lines 175, 180, 195, 210, 237, 241, 243, 245, 259, 274, 281. Editing these lines in a similar manner returns the following error on lines 241, 243, 245, 259:
"my" variable $DEBUG masks earlier declaration in same scope at /Syste +m/Library/Perl/5.8.6/darwin-thread-multi-2level/Geo/OSM/Planet.pm lin +e 241. "my" variable $VERBOSE masks earlier declaration in same scope at /Sys +tem/Library/Perl/5.8.6/darwin-thread-multi-2level/Geo/OSM/Planet.pm l +ine 241.
I understand that I have too many instances of "my" but am not sure why, and therefore unsure how to proceed in order to get the module to run when I execute the script. Any explanation of what I have done wrong – and why it isn't working at present – would be very helpful. Thanks.

In reply to "my" variables masking earlier declaration by pinkybrown

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.