develooper Front page | perl.perl5.porters | Postings from October 2007

Re: [perl #46987] OO-call failures, autoviv-functions & testing theirexistence

Thread Previous | Thread Next
Linda W
October 31, 2007 15:32
Re: [perl #46987] OO-call failures, autoviv-functions & testing theirexistence
Message ID:
This conversation is not going nearly as positively as I had
hoped.  :~(  Ignoring all the kicked up 'dust',

     I would prefer Perl, continue to strive to be the (*usually*)
user-friendly language that it is, and try to do what the user
might have really been intending before throwing a fatal error.
Instead of "throwing an exception", when doing a 'method-syntax'
type call, look for parent methods before throwing an
"Undefined" exception.

     In the same way Perl handles functions differently than
global hashes and attempts "AUTOLOAD" before returning failure,
I'm proposing performing another "check" before giving up.
If method-call syntax was used, check parent classes
for a possible match:

if ( $function_referenced  &&  !exists &$function_referenced ) {
     #   (this code is only called after AUTOLOAD has failed
     #     and Perl is about to throw "Fatal Undef" error)
     If ($user_used_method_call && search_base_classes("method") == True) {
        If ($warn_OO_override) {
          warn "Warning: Undefined-local-stub '$method' ignored";
        call_base_method("parent", $self, "method");
	Unless someone is purposefully trying to die with a Fatal
undefined error, I don't see this behavior causing a compatibility
problem, as it is only called when the program would have terminated


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About