I prefer "fixing" this at the source. I tend to have methods that are purely called for their side-effects, and not for their return values, return the object they acted upon.

And that includes accessors. Tk does it that way as well, and I like it. Example:

sub accessor { my $self = shift; if (@_) { # Sets the attribute. $$self{key} = shift; return $self; } return $$self{key}; # Gets the attribute. }
Then you can write code like this:
my $obj->key1(value1) ->key2(value2) ->key3(value3);

In reply to Re: multiple method calls against the same object, revisited by Anonymous Monk
in thread multiple method calls against the same object, revisited by Aristotle

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