dagolden / ToolSet

(Perl) Load your commonly-used modules in a single import
http://search.cpan.org/dist/ToolSet
4 stars 2 forks source link

Can't nicely implement custom import method on top of ToolSet #6

Open PrincessRTFM opened 5 years ago

PrincessRTFM commented 5 years ago

I know it's an edge case and probably not advised, but I'm using ToolSet to make a basic initialisation for various things, and I want to be able to specify in the use statement for it what it should/shouldn't do. Specifically, I have my toolset module providing a lot of imports, mostly via autouse, and also doing some simple setup for argument processing via Getopt::Long::GetOptions. I wanted to be able to do use Init qw/-noargs/ or similar to turn off that argument processing in certain cases. What this comes down to is that I can't implement my own import() and pass up to ToolSet without doing goto &ToolSet::import - because of caller - and I wanted to know if there was any way to make that easier.

xdg commented 5 years ago

Hi. I haven't worked with this code in a long time, so I don't have a quick answer for you. Possibly, if caller is the problem, you could explore Sub::Uplevel -- though admittedly, that's piling magic upon magic.