|XP is just a number|
(jeffa) Re: chaining method callsby jeffa (Chancellor)
|on Jun 12, 2003 at 11:44 UTC||Need Help??|
I am not only in the 'love it' camp, i am also responsible for helping spread this:
The first time i saw this (and it was in SOAP::Lite as well, BTW) i was a bit perplexed, but once i understood the convience it gave to the client, i loved it. Could it make debugging harder for the client? Sure! Answer? Don't use it!
I went back over my CVS tree to see when i added the change, and what comments i added:
Version 0.98 (12/31/2001) - all methods that normally returned void now return $self (this allows stacking methods)However, i must admit that the large number of folks who don't like this does impact me a bit. I will keep an eye out for bugs that 'stackable methods' might introduce, but i have honestly had no troubles with them, be it debugging or what not. The key is to use the 'plain old boring' style while testing.
Finally, this 'stackable method' style is most likely only for certain OO candidates. DBIx::XHTML_Table (while feature loaded) is a very simple module. All methods serve to get the final output, and i think that is what makes chaining them okay for that module. Other modules might be better off sticking to individual calls.
Damn good question again, perrin :)
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)