in reply to Re: Moose - MOP.pm funny
in thread Moose - MOP.pm funny

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.

Replies are listed 'Best First'.
Re^3: Moose - MOP.pm funny
by ikegami (Patriarch) on Mar 09, 2011 at 20:28 UTC

    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.
        Does it behave differently if you delete the calls create_parameterized_type_constraint too?