Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: OO Pattern Container x Elements and Method Chaining

by LanX (Saint)
on Oct 08, 2021 at 15:31 UTC ( [id://11137353]=note: print w/replies, xml ) Need Help??


in reply to Re: OO Pattern Container x Elements and Method Chaining
in thread OO Pattern Container x Elements and Method Chaining

Sorry, I forgot to make clear that ->do_something() needs to know the actual Container $cont.

I wanted to keep it short for clarity.

update

It could be solved with a special Method Cascading.

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

Replies are listed 'Best First'.
Re^3: OO Pattern Container x Elements and Method Chaining
by jdporter (Paladin) on Oct 08, 2021 at 15:52 UTC

    Ok, but in that case, neither form - with or without the temporary variable - will achieve that. Nothing special gets communicated through method chaining. At least not in POP.

      as I said $cont->get_elem('one') can return another object belonging to a wrapper class "MemberElement" dynamically cloned from $elem0 and enriched with the container info.

      MemberElement could inherit from Element to make sure all methods are transparently available or use AUTOLOAD to delegate methods to $elem0

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

        yes, sure, that's all cool.... but I don't believe that has any bearing on method chaining.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11137353]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (8)
As of 2024-03-29 15:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found