[Chicago-talk] error reporting in overridden method

Randal L. Schwartz merlyn at stonehenge.com
Sun Sep 19 17:09:28 CDT 2004


>>>>> "Jim" == Jim Thomason <thomasoniii at gmail.com> writes:

Jim> Anyway, I subclassed it and overrode the method,

This is the source of your problems.  If you aren't doing
everything the parent did, you're not properly subclassing.

If you can't call SUPER, you should refactor the parent method so that
it provides parts you *can* call, and skip the parts you *can't* call.

So, instead of

  Parent->validate

being standalone, we get

  Parent->validate

that calls

  Parent->validate1, Parent->validate2, Parent->validate3

and then in the kid, we override as

  Child->validate2

so that we replace only that part of the code, permitting parts 1 and
3 to still be called.

Or something like that.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


More information about the Chicago-talk mailing list