Think about Loose Coupling | |
PerlMonks |
Re: elegant way of handling hash?by g0n (Priest) |
on Jan 19, 2006 at 10:22 UTC ( [id://524175]=note: print w/replies, xml ) | Need Help?? |
The context of your problem is still not entirely clear. Still, this example does what you ask for:
Note that the getData->getNameType call has to be treated separately from the simple method calls. If you have other (possibly more complex) chained methods, you'll have to adapt the code to handle those as well (unless someone can think of a better way?) Update: As BrowserUK has said, the chained methods can be done with a string eval. It's a slow and ugly way of doing it, but it works:
-------------------------------------------------------------- "If there is such a phenomenon as absolute evil, it consists in treating another human being as a thing." John Brunner, "The Shockwave Rider".
In Section
Seekers of Perl Wisdom
|
|