Hi all !
I'm trying (unsuccessfully) to use "our" variables outside
of their defining package without qualifying them by the
package name .
Example follows.
I tried with Perl 5.8.8 on Windows (XP) and AIX (5.3) with the same result.
The package (file tryOur.pm):
#!/usr/bin/perl
# -----------------
package tryOur;
our $ExecDir = "/usr/local/bin";
#
1;
The "caller" :
#!/usr/bin/perl
# ----------------
use tryOur;
printf ("U line %d: ExecDir=%s\n",__LINE__,$ExecDir);
printf ("U line %d: ExecDir=%s\n",
__LINE__,$tryOur::ExecDir);
The result on the screen:
U line 6: ExecDir=
U line 7: ExecDir=/usr/local/bin
Why don't i get the value of $ExecDir when not prefixing it with the package name ?
I'm sure to do something wrong, but what ?
Thanks in advance.
Didier