I was thinking something along these lines while in the shower. (Best place to code) :P..
in reply to Re: OO-style modifiers for 'sub' ?
in thread OO-style modifiers for 'sub' ?
Anywho... Thinking about the problem space, and what is needed, it just felt wholly unPerish to write the same or very similar code time and again.
My actual thought was implementing a group of methods, possibly a seperate Class, which did validation. Then providing it a list of method names which needed to be within the inheritance tree. Something along the lines of maybe
If they existed, then who cares who's calling. Then I thought "What if they override a prerequisite method within their own space"?.. Well if they do, then A) They know what they are doing, hence can use our code or B) They have no clue what they are doing, can't quite figure something out, or are trying to shutgun something together and deserve what ever quirks pop up.
($ok, $err) = $obj->validate(
isa => [this, that, theother],
can_do => [meth1, meth2, meth3],
croak $err if (!$ok);
So I haven't really added anything to this thread, so I'm sorry. But I like the post Im replying to and its simplicity, and just wanted to pipe up that its how I was thinking of doing it as well, so an additional ++ to you cause I only have 1 vote for ya.
/* And the Creator, against his better judgement, wrote man.c */