in reply to Error handling in chained method calls
I'm not sure if it covers your question but perl supports a coderef syntax for method calls (which BTW is much faster)
$thing->$c_get_object->$c_get_another_object->$c_do_something
(ATM I can't find the corresponding perldoc) ¹
So when your sure that the methods are not dynamically added or deleted at run-time from the corresponding class, you can make sure that that those methods exist and init the coderefs like constants (e.g. in a BEGIN block).
Cheers Rolf
UPDATE: 1) greping helps, see perltooc#Inheritance Concerns:
Because the &UNIVERSAL::can method returns a reference to the function directly, you can use this directly for a significant performance improvement:for my $parent (@ISA) { if (my $coderef = $self->can($parent . "::CData1")) { $self->$coderef($newvalue); } }
|
|---|