develooper Front page | perl.perl5.porters | Postings from June 2013

[perl #118561] [PATCH] base.pm: failures loading modules are ignored when sub-package exists

Thread Previous
From:
Tony Cook via RT
Date:
June 28, 2013 05:47
Subject:
[perl #118561] [PATCH] base.pm: failures loading modules are ignored when sub-package exists
Message ID:
rt-3.6.HEAD-2552-1372398436-188.118561-15-0@perl.org
On Mon Jun 24 19:08:05 2013, tonyc wrote:
> On Thu Jun 20 17:26:51 2013, haarg wrote:
> > When base tries to load a module and finds that it doesn't exist, it
> > ignores the error if anything the package's stash exists. This is by
> > design, but causes issues when sub-packages exist. Attached is a patch
> > that will ignore sub-packages, while still considering anything else
> > in the stash as marking the package's existence.
> > 
> > The patch is based on the base CPAN 2.18 release from CPAN.
> 
> Thanks, applied as c4f21d8bae2372c750ff63b7e5df47996baa1f39.

I may need to revert this, based on 118655.

The test code in Moose's instance_metaclass_incompat.t has code like:

$@ = undef;
eval {
    package Foo;
    metaclass->import('instance_metaclass' => 'Foo::Meta::Instance');
};
ok(!$@, '... Foo.meta => Foo::Meta is compatible') || diag $@;

$@ = undef;
eval {
    package Bar;
    metaclass->import('instance_metaclass' => 'Bar::Meta::Instance');
};
ok(!$@, '... Bar.meta => Bar::Meta is compatible') || diag $@;

$@ = undef;
eval {
    package Foo::Foo;
    use base 'Foo';
    metaclass->import('instance_metaclass' => 'Bar::Meta::Instance');
};

That use base line is causing the test to fail.

I think what Moose is doing here is reasonable, so I think the change
needs to be reverted, but I welcome discussion.

Tony

---
via perlbug:  queue: perl5 status: resolved
https://rt.perl.org:443/rt3/Ticket/Display.html?id=118561

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About