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


In reply to Re: Conventions with Passing Objects to Objects by jhourcle
in thread Conventions with Passing Objects to Objects by zxViperxz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.