in reply to Importing constans and variables when "require"ing

As Paladin pointed out, this is a compile-time-versus-runtime thing. Furthermore, since you want to fully qualify all the module symbol names anyway, I see no reason to bother with any Exporter stuff.

File XYZ.pm:

# XYZ.pm package XYZ; use strict; use warnings; # require Exporter; # # our @ISA=qw/Exporter/; # our @EXPORT_OK = qw/$PI CONST/; our $PI = 355/113; use constant CONST => 42; 1;
Output:
c:\@Work\Perl\monks\bliako>perl -le "use strict; use warnings; ;; use lib '.'; use XYZ; ;; print 'PI = ', $XYZ::PI; print 'CONST = ', XYZ::CONST; " PI = 3.14159292035398 CONST = 42
(Disambiguation of  XYZ::CONST not needed here.)

Update: BTW: Doing a require in a BEGIN block
    BEGIN { use lib '.';  require XYZ; }
would have had the same phasing effect as the use statement.


Give a man a fish:  <%-{-{-{-<