On Sun, Dec 21, 2008 at 4:03 PM, "Marc Schütz" <[email protected]> wrote:
> syntax error at orp-drawing.pm line 639, near "project["
> syntax error at orp-drawing.pm line 642, near "else"
> orp-drawing.pm had compilation errors.
>
> Maybe perl -c is more strict than the interpreter itself?
No, but whether something is a syntax error depends on the context in
which it was compiled.
a...@aoeu:~$ perl -E 'project[]'
syntax error at -e line 1, near "project["
Execution of -e aborted due to compilation errors.
a...@aoeu:~$ perl -E 'sub project {} project[]'
a...@aoeu:~$
In this case orp-drawing.pm is required() by orp.pl which has defined
a `project' subroutine. And so `project[]' gets parsed as a call to
the `project' subroutine that takes an arrayref.
The compiler emits the error because when it encounters `foo[..]' it
has to decide whether it's a function call or whether someone's trying
to index an array referenced by a bareword. Perl still has a lot of
such legacy bareword cruft:
a...@aoeu:~$ perl -E '*foo = [reverse 1..5]; say foo->[0]'
5
a...@aoeu:~$ perl -E 'say ENV->{SHELL}'
/bin/bash
This should be fixed by changing the line to `project([ ... ])'. And
more generally by writing things as modules that aren't dependent on
previous compilation contexts.
_______________________________________________
Tilesathome mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/tilesathome