In what I think is your xVERBOSE source file, change
to#!/usr/bin/perl my $DEBUG = 1233; my $VERBOSE=5; ...
(untested) and see what happens.#!/usr/bin/perl our $DEBUG = 1233; our $VERBOSE=5; ...
The thing to understand is that a lexical my variable is not a package-global variable. You have code in myApp.pm like
my $DEBUG = $main::DEBUG;
but the package-global $main::DEBUG is nowhere declared and is certainly never initialized | assigned any value.
Update 1: To put it another way, the lexical (my) variable
my $DEBUG = 1233;
defined in (what I think is) the xVERBOSE file is "global" only in the sense that it is in existence and "visible" from the point of declaration in xVERBOSE until the end of that file. The lexical $DEBUG symbol defined by the above statement is not visible in any other file or in any superior scope. Maybe take a look at some of the articles in Variables and Scoping, especially 'our' is not 'my' and Coping with Scoping.
Update 2: Some code to consider:
The lexical $foo symbol defined and initialized in package Foo is inaccessible (except by reference or perhaps by Deep Magick) once the scope of the Foo package ends. Similarly, the lexical $foo symbol defined and initialized in package main is inaccessible (except by reference) once the masking package-global $foo (the our variable) is defined.c:\@Work\Perl\monks>perl -wMstrict -le "{ package Foo; my $foo = 'pure lexical defined in ' . __PACKAGE__; our $foo = 'package global of ' . __PACKAGE__; } ;; print 'in package ', __PACKAGE__; ;; my $foo = 'pure lexical defined in ' . __PACKAGE__; my $ref_to_foo = \$foo; print qq{A: $foo}; ;; our $foo = 'package global of ' . __PACKAGE__; ;; print qq{B: $foo}; print qq{C: $main::foo}; print qq{D: $Foo::foo}; print qq{E: $$ref_to_foo}; " in package main A: pure lexical defined in main B: package global of main C: package global of main D: package global of Foo E: pure lexical defined in main
Give a man a fish: <%-{-{-{-<
In reply to Re: variables passed from main to package
by AnomalousMonk
in thread variables passed from main to package
by FryingFinn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |