in reply to Re: Re: Re: Re: use/require $MODULE (a variable)
in thread use/require $MODULE (a variable)

I'm tempted to try your suggestion, just because it's a bit arcane, but alas, a very simple solution has been found: Since no .pl file package is exporting (unless it names it's subroutines something like
sub main'myfoo {}
there is really no difference in the way I need to handle .pl packages, or just .pl libraries.

In either case, what I'm doing is:

if ( $file =~ /\.pl$/ ) { package main; #printf("(package::main): require \"$file\"\n"); eval "require \"$file\""; package PmLoader; } else { (my $module = $file) =~ s/\.pm$//; #printf("(module): require $module\n"); eval "require $module"; #printf("(module): $module->export_to_level(2);\n"); eval "$module->export_to_level(2)"; }
This combination works properly for both types of .pl files, and for .pm modules that are Exporters. Hmmm, what if the .pm module doesn't export... I'd better think about that one.

Thanks! and good night...
-Cadphile...