Welcome to the Monastery | |
PerlMonks |
Re: Passing package/module names to script as argumentby Eily (Monsignor) |
on Sep 13, 2018 at 12:57 UTC ( [id://1222282]=note: print w/replies, xml ) | Need Help?? |
push(@objects, $_->new()) foreach ("greenObjects", "redObjects"); already does (mostly) the same as push(@objects, greenObjects->new()); push(@objects, redObjects->new()); so this only leaves the use statements. It looks like Module::Load does what you want without needing to call eval. autoload $_ and push(@objects, $_->new()) foreach @ARGV; Edit: Module::Load accepts an arbitrary path though, so you might have to check the input for security.
In Section
Seekers of Perl Wisdom
|
|