in reply to Moose - MOP.pm funny

Your code segment is not very helpful, as all it is is a wrapper for importing a perl library.

From the error message, I think Moose is having a problem with something in ACME::EAD::Processor. It looks like the type declaration of ReadableDir is invalid, but seeing as I don't have the source of ACME::EAD::Processor, I can only guess.

Can you paste in the source of ACME::EAD::Processor, or provide a link, so that we can help you better?

Replies are listed 'Best First'.
Re^2: Moose - MOP.pm funny
by martinm (Novice) on Mar 09, 2011 at 17:51 UTC
    Ah, OK. That points to use Avbrief::TypeConstraints; There is a comment in this file that looks promising - So I deleted the 'old' lines as described

    =head1 ArrayRefs of types this feature was added to Moose sometime after 0.17 which shipped with + etch please uncomment the lines below when our system have migrated to lenn +y or a later Moose Moose::Util::TypeConstraints->create_parameterized_type_constraint ('A +rrayRef[ReadableDir]'); Moose::Util::TypeConstraints->create_parameterized_type_constraint ('A +rrayRef[WritableDir]'); Moose::Util::TypeConstraints->create_parameterized_type_constraint ('A +rrayRef[ReadableFile]'); Moose::Util::TypeConstraints->create_parameterized_type_constraint ('A +rrayRef[WritableFile]'); Moose::Util::TypeConstraints->create_parameterized_type_constraint ('A +rrayRef[WritablePath]'); Moose::Util::TypeConstraints->create_parameterized_type_constraint ('A +rrayRef[File]'); Moose::Util::TypeConstraints->create_parameterized_type_constraint ('A +rrayRef[Dir]'); then you can delete the types defined the 'old' way below =cut subtype 'ArrayRef[ReadableDir]' => as 'ArrayRef' => where { foreach(@$_) { return unless -d $_; return unless -r $_; } return 1; } => message { "One of the directorys in the array is not readable!" }; subtype 'ArrayRef[WritableDir]' => as 'ArrayRef' => where { etc etc etc
    And now get
    Class::MOP::Class::Immutable::Trait #### Class/MOP/Class/Immutable/Trait.pm **** Avbrief::EAD::Processor #### Avbrief/EAD/Processor.pm **** Couldn't load class (Avbrief::EAD::Processor) because: Could not parse + type name (Moose::Util::TypeConstraints) correctly at /usr/lib/perl5 +/Moose/Util/TypeConstraints.pm line 104 Moose::Util::TypeConstraints::create_parameterized_type_constr +aint('Moose::Util::TypeConstraints', 'ArrayRef[ReadableDir]') called +at /usr/share/perl5/Avbrief/TypeConstraints.pm line 72 require Avbrief/TypeConstraints.pm called at /usr/share/perl5/ +Avbrief/EAD/Processor.pm line 3 Avbrief::EAD::Processor::BEGIN() called at /usr/share/perl5/Av +brief/TypeConstraints.pm line 0 eval {...} called at /usr/share/perl5/Avbrief/TypeConstraints. +pm line 0 require Avbrief/EAD/Processor.pm called at /usr/lib/perl5/Clas +s/MOP.pm line 118 Class::MOP::__ANON__() called at /usr/share/perl5/Try/Tiny.pm +line 71 eval {...} called at /usr/share/perl5/Try/Tiny.pm line 67 Try::Tiny::try('CODE(0x9a2e5b0)', 'Try::Tiny::Catch=REF(0x9f68 +570)') called at /usr/lib/perl5/Class/MOP.pm line 129 Class::MOP::load_first_existing_class('Avbrief::EAD::Processor +') called at /usr/lib/perl5/Class/MOP.pm line 141 Class::MOP::load_class('Avbrief::EAD::Processor', undef) calle +d at /usr/lib/perl5/Moose/Meta/Class.pm line 288 Moose::Meta::Class::superclasses(undef, 'Avbrief::EAD::Process +or') called at /usr/lib/perl5/Moose.pm line 54 Moose::extends('Moose::Meta::Class=HASH(0x9edefa0)', 'Avbrief: +:EAD::Processor') called at /usr/lib/perl5/Moose/Exporter.pm line 294 Moose::extends('Avbrief::EAD::Processor') called at /usr/share +/perl5/Avbrief/EAD/TAM/Processor.pm line 10 require Avbrief/EAD/TAM/Processor.pm called at /avprog/bin/pro +cess_eadesi_tam.pl line 4 main::BEGIN() called at /usr/share/perl5/Avbrief/TypeConstrain +ts.pm line 0 eval {...} called at /usr/share/perl5/Avbrief/TypeConstraints. +pm line 0 Compilation failed in require at /usr/share/perl5/Avbrief/EAD/Processo +r.pm line 3. BEGIN failed--compilation aborted at /usr/share/perl5/Avbrief/EAD/Proc +essor.pm line 3. Compilation failed in require at /usr/lib/perl5/Class/MOP.pm line 118. at /usr/lib/perl5/Class/MOP.pm line 124 Class::MOP::__ANON__('Could not parse type name (Moose::Util:: +TypeConstraints) corr...') called at /usr/share/perl5/Try/Tiny.pm lin +e 98 Try::Tiny::try('CODE(0x9a2e5b0)', 'Try::Tiny::Catch=REF(0x9f68 +570)') called at /usr/lib/perl5/Class/MOP.pm line 129 Class::MOP::load_first_existing_class('Avbrief::EAD::Processor +') called at /usr/lib/perl5/Class/MOP.pm line 141 Class::MOP::load_class('Avbrief::EAD::Processor', undef) calle +d at /usr/lib/perl5/Moose/Meta/Class.pm line 288 Moose::Meta::Class::superclasses(undef, 'Avbrief::EAD::Process +or') called at /usr/lib/perl5/Moose.pm line 54 Moose::extends('Moose::Meta::Class=HASH(0x9edefa0)', 'Avbrief: +:EAD::Processor') called at /usr/lib/perl5/Moose/Exporter.pm line 294 Moose::extends('Avbrief::EAD::Processor') called at /usr/share +/perl5/Avbrief/EAD/TAM/Processor.pm line 10 require Avbrief/EAD/TAM/Processor.pm called at /avprog/bin/pro +cess_eadesi_tam.pl line 4 main::BEGIN() called at /usr/share/perl5/Avbrief/EAD/TAM/Proce +ssor.pm line 0 eval {...} called at /usr/share/perl5/Avbrief/EAD/TAM/Processo +r.pm line 0 Compilation failed in require at /avprog/bin/process_eadesi_tam.pl lin +e 4. BEGIN failed--compilation aborted at /avprog/bin/process_eadesi_tam.pl + line 4.

      create_parameterized_type_constraint is not a method.

      Moose::Util::TypeConstraints->create_parameterized_type_constraint(... +)

      should be

      Moose::Util::TypeConstraints::create_parameterized_type_constraint(... +)

      I wonder what purpose calling create_parameterized_type_constraint would have. Maybe it has side-effects?

      I think you can delete both the "old" way and the commented way.

        That seems to work (more problems but it gets further!)

        Cheers.

        Martin.
Re^2: Moose - MOP.pm funny
by martinm (Novice) on Mar 09, 2011 at 16:55 UTC
    package Avbrief::EAD::Processor; use Moose; use Avbrief::TypeConstraints; our $VERSION = 3.00; has file => (isa=>'ReadableFile', is=>'ro', required=>1); has logger => (isa=>'Logger', is=>'ro', required=>1, handles=>[qw/log +error debug/]); has schema => (isa=>'Avbrief::DataLayer::DBIC', is=>'ro'); sub process { die "overide me!" }; 1;
    Let me know if you need anything else - I'm not a perl developer!
      Line 3 is use Avbrief::TypeConstraints;, so the error is in Avbrief::TypeConstraints. Unfortunately, we don't have a line number for the actual error.