Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Tuesday September 28, 2004
12:36 PM

Weird Inheritence Problems

[ #21094 ]

I've spent much of the day unsuccessfully tracking down a bug. We have an abstract base class (A) for building and transporting files for customers. One of our customers has an abstract class (B) which inherits from 'A'. In the process of creating two classes (D and E) that inherit from 'B', I realized that they had common functionality that I couldn't put in 'B', so I created 'C' for them to inherit from. I didn't use delegation because I had to guarantee (apart from the tests) that certain methods in 'B' were overridden. It looks like this:

   / \
  D   E

I hate overusing inheritence and in this case, it's for good cause (in fact, now I pretty much only use it with abstract classes.) Somewhere along the way things horribly broke down. 'A' tried to call C::transport method and the program died when it couldn't find it, despite the fact that 'A' implements it. After a lot of fruitless debugging, out of desperation I wrote:

sub C::transport { shift->SUPER::transport }

That shouldn't be necessary, except that it fixed the problem. Then I checked the logs and everything looked normal and &A::transport was properly writing out its behavior to the log files, stating that it had in fact transported the file in question. Except the file was never sent. It's going to be a long day.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.