in reply to Re: Re: Re: Re: use/require $MODULE (a variable)
in thread use/require $MODULE (a variable)
there is really no difference in the way I need to handle .pl packages, or just .pl libraries.sub main'myfoo {}
In either case, what I'm doing is:
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.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)"; }
Thanks! and good night...
-Cadphile...
|
|---|