Skip Menu |
 

This queue is for tickets about the Object-InsideOut CPAN distribution.

Report information
The Basics
Id: 17055
Status: resolved
Priority: 0/
Queue: Object-InsideOut

People
Owner: Nobody in particular
Requestors: Brad.Eisenberg [...] morganstanley.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 1.26
  • 1.27
  • 1.28
  • 1.29
Fixed in: 1.31

Attachments


Subject: Class t::Parent::Child fails to inherit from t/Parent.pm
Download (untitled) / with headers
text/plain 1.1k
Under Object::InsideOut, r1.29, inheritance mechanism fails when *) parent is defined in an external file, e.g., t/Parent.pm. and *) name of parent class IS the leading substring of name of child class For example, t::Parent t::Parent::Child The workaround for the class writer is to use the parent explicitely, e.g., package t::Parent::Child { use t::Parent; use Object::InsideOut qw( t::Parent ); } However, your documentation (and the code in sub import) imply that you intended "use Object::InsideOut qw( t::Parent );" to be a drop-in replacement for "use base qw( t::Parent );". Attached tar.gz file includes a patch in the form of a diff -u against Object/InsideOut.pm, r1.29 (file InsideOut.pm.diff), as well as eight test cases. Please see comments at the top of each test case. The main test case is t/22-external_leading_parent.t. This case highlights the bug. The other cases check that the patch does not break anything. This is perl, v5.8.4 built for i686-linux-thread-multi Linux coitlx05 2.4.21-27.8.1.ELhugemem #1 SMP Sat Apr 16 17:59:19 EDT 2005 i686 Thank you.
Subject: OIO_patch_n_tests.tar.gz
Download OIO_patch_n_tests.tar.gz
application/x-gzip-compressed 2.6k

Message body not shown because it is not plain text.

Download (untitled) / with headers
text/plain 978b
Thanks for the bug report and patch, Brad. I put in a fix that provides 'correct' behaviour without duplicating code from base.pm: 237,240c237,238 < my @parts = split(/::/, $pkg); < my $part2 = pop(@parts) . '::'; < my $part1 = join('::', @parts) . '::'; < if (! exists(${$part1}{$part2})) { --- Show quoted text
> # If no package symbols, then load it > if (! grep { $_ !~ /::$/ } keys(%{$pkg.'::'})) {
Further, I made empty packages 'illegal': 246a245,248 Show quoted text
> # Empty packages make no sense > if (! grep { $_ !~ /::$/ } keys(%{$pkg.'::'})) { > OIO::Code->die('message' => "Package '$pkg' is
empty"); Show quoted text
> }
Your test cases were very helpful. The above corrects all the anomolies and provides consistent behaviour. (OIO acts 'like' base.pm, but does not have to be exactly the same.) I also condensed your tests into a single test file. Thanks again.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.