Just another Perl shrine | |
PerlMonks |
Re: Imagination greater than reality?by kcott (Archbishop) |
on Jul 11, 2017 at 06:42 UTC ( [id://1194779]=note: print w/replies, xml ) | Need Help?? |
G'day writch, "Is what I'm thinking of outside of the current box, ...?" Not outside the current box, or even outside an old box: the builtin module File::Spec, for instance, has been doing this sort of thing for years. [I'm fairly sure it's more than a decade, but I don't have specific information to hand.] "... or am I just doing the right thing the wrong way?" If you're getting errors, or it's not working as expected, then probably "the wrong way". :-) I would consider reordering the elements of your namespace such that the least specific element is first and the most specific last. It's your module, you can call it whatever you like, and there may be aspects of which I'm not aware; however, I probably would have chosen:
You can keep generic code in Formula::State, perhaps something like:
Then in Formula::State::$state:
That also keeps your state-related formulae separate from Formula::Molecular, Formula::Secret, and so on. You're showing use, which suggests that you want to load your module at compile time. You can do that with something like this:
I ran a quick command line test (mainly to check the syntax I'd given you):
I initially used the first() function, which I thought was in both of those modules. It's not, so I got an error; however, that's also useful feedback.
— Ken
In Section
Seekers of Perl Wisdom
|
|