In every case I've written so far, the data type object is always the first argument to these functions. The process functions are contained in their own modules, such as MyCode::ProcessA, MyCode::ProcessB, etc. These functions typically return a new data type object.$data = /some data read from file, perl object/; $data = process_A( $data, @options ); $data = process_B( $data, @more_options );
Now, in the aforementioned thread, someone suggested that objectifying this might make more sense:
which is just as clean (if not cleaner). However, the number of 'process' functions that I might generate are not limited, and that means that every time I add a new module with a new process, I'd have to modify the data type code in addition to add this feature, which is a nuicance.$data = /some data read from file, perl object/; $data = $data->process_A( @options ); $data = $data->process_B( @more_options );
So, I'm wondering if there is a "stupid perl trick" that's sufficiently portable (between 5.005 and 5.6) such that when the process moduels are loaded, they can automagically load any appropriate functions into the data type method list, eg:
I figure if anything, this will be something in the BEGIN block for the process modules and possibly an AUTOLOAD in the data type code, but I'm not sure what needs to be added. Any suggestions or am I asking for the impossble?# data type object at this point has no 'process_c' method. use MyCode::ProcessC; # now it ought to.. $newdata = $data->process_c( @even_more_options );
-----------------------------------------------------
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
|
|---|