Abigail schrieb:
>
> You seem to have the impression that if you're using a variable
> $MyModule:
EBUG, you have to have a MyModule.pm, and you have
> to 'use' that file.
>
> That's not true.
>
>
> package Fnurd;
>
> use strict;
> use warnings;
>
> say "Hi, I'm a debugging message." if $MyModule:
EBUG;
>
>
> works well.
>
>
> Abigail
For curious lurkers like me, soaking up wisdom from c.l.p.m, I think it
should be mentioned that $MyModule:

EBUG needs to be declared via 'our'
for this to work, because:
$ perl -Mstrict -Mwarnings -le'
package MyModule;
my $DEBUG = 1;
package Fnurd;
print "Debug on" if $MyModule:

EBUG;
'
Name "MyModule:

EBUG" used only once: possible typo at -e line 5.
whereas with 'our':
$ perl -Mstrict -Mwarnings -le'
package MyModule;
our $DEBUG = 1;
package Fnurd;
print "Debug on" if $MyModule:

EBUG;
'
Debug on
But then I don't even have to use the fully qualified name:
$ perl -Mstrict -Mwarnings -le'
package MyModule;
our $DEBUG = 1;
package Fnurd;
print "Debug on" if $DEBUG;
'
Debug on
Toying a little more, I find that
$ perl -Mstrict -Mwarnings -le'
package MyModule;
my $DEBUG = 1;
package Fnurd;
print "Debug on" if $DEBUG;
'
Debug on
works equally well.
What am I not understanding?
Thank you,
Andreas Pürzer
--
Have Fun,
and if you can't have fun,
have someone else's fun.
The Beautiful South