in reply to Conventions with Passing Objects to Objects
After looking at a bunch of modules and other perl code I have realised I have made an error by making object argument names _object seeing that is is against the private variable declaration (however I really like my convention seeing that I can tell an object and a normal argument apart).
The first rule of coding -- write for whomever is going to be maintaining the code. In a case like this, it's you, not someone else, so you are free to use whatever coventions you like. There's no one right way to do it -- I just suggest that whatever convention you use, you try to use it as consistently as possible.
I have also been unable to find any other code that uses object passing like this which brings be to my question:
How, as a proper perl programmer using proper conventions should this be written? I have not seen any object passing in other CPAN modules or example code so how should it be done?
If you want to jump right in, one example of Perl that uses a bunch of objects that reference other objects, see SOAP::Lite. I haven't done a full read of it since 0.55, but I found it enlightening, and disturbing at the same time.
I realise that what I have done works and for me works very well but knowing the correct way to do it is very important for me for future reference (or rewriting if I've completly stuffed it up) =).
If you have a system that works, there's little reason to change just for change's sake. If you just want to bone up on what's 'normal' for Perl (if there is such a thing), I'd suggest reading Perl Best Practices and Perl Medic
|
|---|