Skip Menu |

This queue is for tickets about the Archive-RPM CPAN distribution.

Report information
The Basics
Id: 100701
Status: new
Priority: 0/
Queue: Archive-RPM

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.07
Fixed in: (no value)



Subject: Does not compile with Moose-2.1402: The _header attribute is trying to delegate to a class which has not been loaded - RPM2::Header
The Archive::RPM2 cannot be compiled with Moose 2.1402. E.g. tests fail like this: # Failed test 'use Archive::RPM;' # at t/00-load.t line 4. # Tried to use 'Archive::RPM'. # Error: The _header attribute is trying to delegate to a class which has not been loaded - RPM2::Header at /usr/lib64/perl5/vendor_perl/Class/MOP/Class.pm line 901 # Class::MOP::Class::catch {...} ('Moose::Exception::DelegationToAClassWhichIsNotLoaded=HASH(0x49051f0)') called at /usr/share/perl5/vendor_perl/Try/Tiny.pm line 104 # Try::Tiny::try('CODE(0x48efbf0)', 'Try::Tiny::Catch=REF(0x48e7ca8)') called at /usr/lib64/perl5/vendor_perl/Class/MOP/Class.pm line 903 # Class::MOP::Class::_post_add_attribute('Moose::Meta::Class::__ANON__::SERIAL::1=HASH(0x2e420b8)', 'Moose::Meta::Attribute=HASH(0x48e8740)') called at /usr/lib64/perl5/vendor_perl/Class/MOP/Mixin/HasAttributes.pm line 38 # Class::MOP::Mixin::HasAttributes::add_attribute('Moose::Meta::Class::__ANON__::SERIAL::1=HASH(0x2e420b8)', 'Moose::Meta::Attribute=HASH(0x48e8740)') called at /usr/lib64/perl5/vendor_perl/Moose/Meta/Class.pm line 572 # Moose::Meta::Class::add_attribute('Moose::Meta::Class::__ANON__::SERIAL::1=HASH(0x2e420b8)', '_header', 'definition_context', 'HASH(0x48e5a80)', 'is', 'ro', 'isa', 'RPM2::Header', 'lazy_build', 1, 'handles', 'Regexp=REGEXP(0x2c6aec8)') called at /usr/lib64/perl5/vendor_perl/Moose.pm line 76 # Moose::has('Moose::Meta::Class::__ANON__::SERIAL::1=HASH(0x2e420b8)', '_header', 'is', 'ro', 'isa', 'RPM2::Header', 'lazy_build', 1, 'handles', 'Regexp=REGEXP(0x2c6aec8)') called at /usr/lib64/perl5/vendor_perl/Moose/Exporter.pm line 418 # Moose::has('_header', 'is', 'ro', 'isa', 'RPM2::Header', 'lazy_build', 1, 'handles', 'Regexp=REGEXP(0x2c6aec8)') called at /home/test/fedora/perl-Archive-RPM/Archive-RPM-0.07/blib/lib/Archive/RPM.pm line 62 # require Archive/RPM.pm at t/00-load.t line 4 # main::BEGIN at /home/test/fedora/perl-Archive-RPM/Archive-RPM-0.07/blib/lib/Archive/RPM.pm line 0 # eval {...} at /home/test/fedora/perl-Archive-RPM/Archive-RPM-0.07/blib/lib/Archive/RPM.pm line 0 # eval 'package main; This can be reduce to this code: $ cat Archive/RPM.pm package Archive::RPM; use Moose; use RPM2 0.67; has _header => ( is => 'ro', isa => 'RPM2::Header', lazy_build => 1, # http://www.perlmonks.org/?node_id=588315 kick ass! handles => qr/^(?!(?s:.*)^(files|changelog|nvr)$)/, ); 1; [test@fedora-22 tmp]$ perl -I. -e 'use Archive::RPM' The _header attribute is trying to delegate to a class which has not been loaded - RPM2::Header at /usr/lib64/perl5/vendor_perl/Class/MOP/Class.pm line 901 Class::MOP::Class::catch {...} ('Moose::Exception::DelegationToAClassWhichIsNotLoaded=HASH(0x1cdac08)') called at /usr/share/perl5/vendor_perl/Try/Tiny.pm line 104 Try::Tiny::try('CODE(0x1cda758)', 'Try::Tiny::Catch=REF(0x1b88148)') called at /usr/lib64/perl5/vendor_perl/Class/MOP/Class.pm line 903 Class::MOP::Class::_post_add_attribute('Moose::Meta::Class=HASH(0x1a1de38)', 'Moose::Meta::Attribute=HASH(0x1cdace0)') called at /usr/lib64/perl5/vendor_perl/Class/MOP/Mixin/HasAttributes.pm line 38 Class::MOP::Mixin::HasAttributes::add_attribute('Moose::Meta::Class=HASH(0x1a1de38)', 'Moose::Meta::Attribute=HASH(0x1cdace0)') called at /usr/lib64/perl5/vendor_perl/Moose/Meta/Class.pm line 572 Moose::Meta::Class::add_attribute('Moose::Meta::Class=HASH(0x1a1de38)', '_header', 'definition_context', 'HASH(0x19e6c48)', 'is', 'ro', 'isa', 'RPM2::Header', 'lazy_build', 1, 'handles', 'Regexp=REGEXP(0x1b5b0e0)') called at /usr/lib64/perl5/vendor_perl/Moose.pm line 76 Moose::has('Moose::Meta::Class=HASH(0x1a1de38)', '_header', 'is', 'ro', 'isa', 'RPM2::Header', 'lazy_build', 1, 'handles', 'Regexp=REGEXP(0x1b5b0e0)') called at /usr/lib64/perl5/vendor_perl/Moose/Exporter.pm line 418 Moose::has('_header', 'is', 'ro', 'isa', 'RPM2::Header', 'lazy_build', 1, 'handles', 'Regexp=REGEXP(0x1b5b0e0)') called at Archive/RPM.pm line 6 require Archive/RPM.pm at -e line 1 main::BEGIN at Archive/RPM.pm line 0 eval {...} at Archive/RPM.pm line 0 Compilation failed in require at -e line 1. BEGIN failed--compilation aborted at -e line 1. If you comment out the "handle" attribute, it will pass. Recent Moose seems not able to enumerate subroutines of a module which has not been loaded explicitly (use RPM2::Header). The RPM2::Header resides in RPM2.pm file.
From: ppisar [...] redhat.com
Dne Čt 04.pro.2014 07:35:12, ppisar napsal(a): Show quoted text
> The Archive::RPM2 cannot be compiled with Moose 2.1402. E.g. tests > fail like this: > > # Failed test 'use Archive::RPM;' > # at t/00-load.t line 4. > # Tried to use 'Archive::RPM'. > # Error: The _header attribute is trying to delegate to a class > which has not been loaded - RPM2::Header at > /usr/lib64/perl5/vendor_perl/Class/MOP/Class.pm line 901
See <http://stackoverflow.com/questions/21757426/delegationtoaclasswhichisnotloaded-error-with-moose-and-xmllibxml> for similar question. See CPAN RT#100702 for a bug report against Moose.
From: ppisar [...] redhat.com
Dne Čt 04.pro.2014 07:35:12, ppisar napsal(a): Show quoted text
> Recent Moose seems not able to enumerate subroutines of a module which > has not been loaded explicitly (use RPM2::Header). The RPM2::Header > resides in RPM2.pm file.
Fix is attached.
Subject: Archive-RPM-0.07-Inject-RPM2-Headers-into-INC-for-Moose-2.1005.patch
From b70bfb107ea444b0e574e46757c409b4344620e3 Mon Sep 17 00:00:00 2001 From: Paul Howarth <paul@city-fan.org> Date: Thu, 4 Dec 2014 14:51:00 +0100 Subject: [PATCH] Inject RPM2::Headers into %INC for Moose > 2.1005 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moose > 2.1005 inspects %INC for loaded classes which is not true for RPM2::Headers which comes from RPM2.pm Fixes CPAN RT#100701. See Moose's CPAN RT#100702. Signed-off-by: Petr Písař <ppisar@redhat.com> --- lib/Archive/RPM.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Archive/RPM.pm b/lib/Archive/RPM.pm index c89c07c..913ce8c 100644 --- a/lib/Archive/RPM.pm +++ b/lib/Archive/RPM.pm @@ -32,6 +32,12 @@ use Archive::RPM::ChangeLogEntry; our $VERSION = '0.07'; +# Moose 2.14 onwards looks for RPM2::Header in %INC but it's from RPM2.pm +# (CPAN RT#100701) +unless ( $INC{ "RPM2/Header.pm" } ) { + $INC{ "RPM2/Header.pm" } = $INC{ "RPM2.pm" }; +} + with 'MooseX::Traits'; has '+_trait_namespace' => (default => 'Archive::RPM::TraitFor'); -- 1.9.3