Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
as I said, there is legacy code which is using Method Chaining (I didn't design it)


Now the model changed and Person "Willy" can be member of different households

> I have never actually run into a case where an element needed to know its container

I have no idea how method chaining would be implemented else, since ->clean_house() is referring to $house

In the new model case ->get_member() can't return a Person object anymore

One possibility discussed here is to return a Wrapper-Object Inhabitant which wraps the relation

'Person ->belongs_ to-> House'

and delegates accordingly.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

) update s/Member/Inhabitant/ for consistency to previous posts


regarding your suggestion, see Re^3: OO Pattern Container x Elements and Method Chaining

In reply to Re^3: OO Pattern Container x Elements and Method Chaining (House, Person, Inhabitant) by LanX
in thread OO Pattern Container x Elements and Method Chaining by LanX

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2022-08-11 03:15 GMT
Find Nodes?
    Voting Booth?

    No recent polls found