in reply to Re: Possible Stupid Perl Trick - Importing method into object class?
in thread Possible Stupid Perl Trick - Importing method into object class?

While this will probably work, it ends up with the same problem from the original idea: you have to maintain a repository of new functions which may be overlooked. That is, if I add a new processing step, I have to remember to add it to this file to make sure it works. Sure, as opposed to creating a new object method (and also remembering to import the new processing module), this is probably a bit easier, but again, it doesn't appear to solve the original problem.

(And no, it's not the goto at the end of the code nor the lack of strictness that makes me wary of this method :-).

-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important

  • Comment on Re: Re: Possible Stupid Perl Trick - Importing method into object class?

Replies are listed 'Best First'.
Re: Re: Re: Possible Stupid Perl Trick - Importing method into object class?
by dws (Chancellor) on Dec 08, 2001 at 00:11 UTC
    While this will probably work, it ends up with the same problem from the original idea: you have to maintain a repository of new functions which may be overlooked.

    You could skip the repository, and so something like

    if ( -f "$attr.sub" ) { # load and eval "$attr.sub" goto &$attr; }
    I used a registry so that you could stage the debugging of new functions. If that isn't an issue for you, then don't use a registry. I've used a registry for something like this in years past, and have found it useful, but YMMV.