rlucas has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

Is there a known problem with inheritance on Perl 5.6.0?

Briefly: I was working with a CPAN module that relies upon my subclass inheriting from an inheritance hierarchy above it. On a Linux box with 5.6.1 everything works, but my tests fail on a Mac with 5.6.0 with a "method not found" error. All the modules are installed, and the @ISA arrays seem to be intact and show the right inheritance -- but calls to UNIVERSAL::isa show that the Linux/5.6.1 setup correctly inherits, while the Mac/5.6.0 setup breaks 3 classes up the hierarchy.

Is there a smoking gun I'm missing here? E.g., is it well-known that 5.6.0 doesn't inherit properly?

(If there is no smoking gun or further info is needed, I can post specifics; the breakage seems to be between Class::DBI:__::Base and Ima::DBI and I have tests that bear this out.)

Best,

Randall
  • Comment on Broken inheritance on 5.6.0 / Mac OS x 10.2 ?

Replies are listed 'Best First'.
Re: Broken inheritance on 5.6.0 / Mac OS x 10.2 ?
by rob_au (Abbot) on Feb 17, 2004 at 23:14 UTC
    I've used inherited classes on the default perl 5.6.0 install on OS X without issue previously - Are you certain that the base class from which the package inherits is actually installed? Can you produce a short test case which demonstrates this broken functionality?

     

    perl -le "print unpack'N', pack'B32', '00000000000000000000001011000100'"

Re: Broken inheritance on 5.6.0 / Mac OS x 10.2 ?
by Anonymous Monk on Feb 18, 2004 at 02:50 UTC
    (If there is no smoking gun or further info is needed, I can post specifics; the breakage seems to be between Class::DBI:__::Base and Ima::DBI and I have tests that bear this out.)
    You are the "smoking gun" :) What makes a bad question? How (Not) To Ask A Question Before You Post ....

    You need to provide us with a small example which demonstrates the problem, an exact error message (cut 'n' paste), and the versions of all the modules involved (namely Class::DBI and Ima::DBI).

      Thank you for the responses ;) I realize that my original message was less than comprehensive -- I just wanted to see if there was any low-hanging fruit (e.g. "yes, everyone knows 5.6.0 does this").

      The exact error I get is precipitated by calling the Splash::Container->create( {} ) method, inherited from Class::DBI:

      Can't locate object method "select_val" via package "DBI::st" at /Libr +ary/Perl/Class/DBI.pm line 532.

      That "select_val" method is supposed to be inherited by Class::DBI from Class::DBI::__::Base from Ima::DBI. But as you will see below, it seems to get broken before inheriting from Ima::DBI.

      Here is the exploratory test script I wrote. As background, my class Splash::Container inherits from Splash::Base, which in turn inherits from Class::DBI (in turn, this inherits from Class::DBI::__::Base which inherits from Ima::DBI; it is this final inheritance which seems not to work at all).

      #!usr/bin/perl -w use Class::DBI; use Splash::Container; warn "Splash::Container is a Class::DBI=" . ( UNIVERSAL::isa("Splash:: +Container", "Class::DBI") ? "yes" : "no") ; warn "Splash::Container is an Ima::DBI=" . ( UNIVERSAL::isa("Splash::C +ontainer", "Ima::DBI") ? "yes" : "no") ; warn "Class::DBI is a Class::DBI::__::Base=" . ( UNIVERSAL::isa("Class +::DBI", "Class::DBI::__::Base") ? "yes" : "no") ; warn "Class::DBI::__::Base is a Ima::DBI=" . ( UNIVERSAL::isa("Class:: +DBI::__::Base", "Ima::DBI") ? "yes" : "no") ; warn "here are the isas for Class::DBI=" . join ";", @Class::DBI::ISA; warn "here are the isas for Class::DBI::__::Base=" . join ";", @Class: +:DBI::__::Base::ISA; warn "here are the isas for Ima::DBI=" . join ";", @Ima::DBI::ISA; warn "here is VERSION for Class::DBI=" . $Class::DBI::VERSION; warn "here is VERSION for Ima::DBI=" . $Ima::DBI::VERSION; warn "here is VERSION for DBI=" . $DBI::VERSION; warn "here is VERSION for DBD::Pg=" . $DBD::Pg::VERSION; 1;

      On my Linux box with Perl 5.6.1, this gives output as expected:

      Splash::Container is a Class::DBI=yes at t/imadbi.pl line 6. Splash::Container is an Ima::DBI=yes at t/imadbi.pl line 7. Class::DBI is a Class::DBI::__::Base=yes at t/imadbi.pl line 8. Class::DBI::__::Base is a Ima::DBI=yes at t/imadbi.pl line 9. here are the isas for Class::DBI=Class::DBI::__::Base at t/imadbi.pl l +ine 11. here are the isas for Class::DBI::__::Base=Class::Data::Inheritable;Cl +ass::Accessor;Ima::DBI at t/imadbi.pl line 12. here are the isas for Ima::DBI=Class::WhiteHole;DBI;Class::Data::Inher +itable at t/imadbi.pl line 13. here is VERSION for Class::DBI=0.94 at t/imadbi.pl line 15. here is VERSION for Ima::DBI=0.31 at t/imadbi.pl line 16. here is VERSION for DBI=1.39 at t/imadbi.pl line 17. here is VERSION for DBD::Pg=1.22 at t/imadbi.pl line 18.

      On my Mac OS X 10.2 box with Perl 5.6.0, however, things seem to break between Class::DBI::__::Base and Ima::DBI, despite the contents of ISA:

      Splash::Container is a Class::DBI=yes at t/imadbi.pl line 6. Splash::Container is an Ima::DBI=no at t/imadbi.pl line 7. Class::DBI is a Class::DBI::__::Base=yes at t/imadbi.pl line 8. Class::DBI::__::Base is a Ima::DBI=no at t/imadbi.pl line 9. here are the isas for Class::DBI=Class::DBI::__::Base at t/imadbi.pl l +ine 11. here are the isas for Class::DBI::__::Base=Class::Data::Inheritable;Cl +ass::Accessor;Ima::DBI at t/imadbi.pl line 12. here are the isas for Ima::DBI=Class::WhiteHole;DBI;Class::Data::Inher +itable at t/imadbi.pl line 13. here is VERSION for Class::DBI=0.95 at t/imadbi.pl line 15. here is VERSION for Ima::DBI=0.31 at t/imadbi.pl line 16. here is VERSION for DBI=1.40 at t/imadbi.pl line 17. here is VERSION for DBD::Pg=1.22 at t/imadbi.pl line 18.

      Any thoughts? My current ideas are:

      • Class::DBI and DBI minor version differences -- however, the changelogs don't seem to indicate anything I recognize as likely to break stuff.
      • Perl minor version difference -- I know that 5.6.0 is supposed to have some mysterious bugs. However, the perldelta561 didn't seem to list any likely culprits, either.
      • Mac OS X case-insensitive directory structure causing foobars?
      • The name Class::DBI::__::Base might not play nicely with Mac OS X?
      Any thoughts you folks have are appreciated.

      Best,

      Randall

      Update: In fact, this seems to be a problem with Class::DBI 0.95 (or with my setup and that version), NOT with the inheritance, because consistently 0.95 breaks on both Mac and Linux and 0.94 works on both (although the discrepancy in the isa(...) remains).