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.