use of our variable causes compilation errors

P

Perl-Misc

Something strange today,
I got carried away for a few minutes, thinking my whole code was wrong,
when I kept getting these compilation errors

hcm03% perl -wc dfw.pl
Use of reserved word "our" is deprecated at dfw.pl line 22.
Global symbol "$ErrorMessage" requires explicit package name at dfw.pl
line 22
Use of reserved word "our" is deprecated at dfw.pl line 23.
Global symbol "$REL_TAR" requires explicit package name at dfw.pl line
23.
Use of reserved word "our" is deprecated at dfw.pl line 24.
Global symbol "$RELEASE" requires explicit package name at dfw.pl line
24.
Use of reserved word "our" is deprecated at dfw.pl line 25.
Global symbol "$TARGET" requires explicit package name at dfw.pl line
25.
Use of reserved word "our" is deprecated at dfw.pl line 26.
Global symbol "$TMP_TAR" requires explicit package name at dfw.pl line
26.
Use of reserved word "our" is deprecated at dfw.pl line 27.
Global symbol "$BASELINE" requires explicit package name at dfw.pl line
27.
Use of reserved word "our" is deprecated at dfw.pl line 28.
Global symbol "$DFW_BACKUP" requires explicit package name at dfw.pl
line 28.
Use of reserved word "our" is deprecated at dfw.pl line 29.
Global symbol "$DFW_CODE" requires explicit package name at dfw.pl line
29.
Use of reserved word "our" is deprecated at dfw.pl line 30.
Global symbol "$opt_R" requires explicit package name at dfw.pl line
30.
Use of reserved word "our" is deprecated at dfw.pl line 31.
Global symbol "$opt_T" requires explicit package name at dfw.pl line
31.
Use of reserved word "our" is deprecated at dfw.pl line 32.
Global symbol "$opt_B" requires explicit package name at dfw.pl line
32.
dfw.pl had compilation errors.

Use of 'our' for variable declaration gave serious compilation errors
because the system default perl executable was in v5.005_03, whereas we
were using an advanced version of perl (v5.8.0) for all our programs.

Recompiled using the perl correct perl version, its all fine now.
 
B

Brian McCauley

Perl-Misc said:
Use of reserved word "our" is deprecated

Use of 'our' for variable declaration gave serious compilation errors
because the system default perl executable was in v5.005_03, whereas we
were using an advanced version of perl (v5.8.0) for all our programs.

Yes, in general using language features that post-date your compiler
will cause errors.

However what you are seeing is a somewhat special case.

Introducing a new reserved word into a language is not something that
should be taken lightly as it may break exisitng codebases. When it
was decided to introduce our into Perl it was not done in one step.
First (in 5.5 IIRC) a warning was introduced to warn people that their
code contained the word "our" but contiued to treat it semantically
like any unreserved word. And then in a later version (5.6 IIRC) the
new semantics were added.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top