tags:

views:

227

answers:

1

I have perl 5.10.1 installed on my ubuntu machine. I wanted to install the Moose and MooseX extentions, so I did install the packages with the aptitude package manager. Here are all the packages I have installed:

$ sudo apt-cache pkgnames | grep moose
libmoosex-singleton-perl
libmoosex-compiletime-traits-perl
libmoosex-types-structured-perl
libmoosex-traits-pluggable-perl
libmoosex-nonmoose-perl
libmoosex-methodattributes-perl
libmoosex-strictconstructor-perl
libmoosex-classattribute-perl
libany-moose-perl
libmoosex-traits-perl
libmoosex-meta-typeconstraint-forcecoercion-perl
libmoosex-attributehelpers-perl
libmoosex-types-set-object-perl
libmoosex-multiinitarg-perl
libmoosex-has-sugar-perl
libmoosex-role-withoverloading-perl
libmoosex-getopt-perl
libmoosex-aliases-perl
libmoosex-types-varianttable-perl
libmoosex-types-datetime-perl
libmoosex-yaml-perl
libmoosex-daemonize-perl
libmoosex-blessed-reconstruct-perl
libmoosex-emulate-class-accessor-fast-perl
libmoosex-poe-perl
libmoose-perl
libmoosex-types-common-perl
libmoosex-async-perl
libmoosex-method-signatures-perl
libmoosex-storage-perl
libmoosex-log-log4perl-perl
libmoose-policy-perl
libmoosex-semiaffordanceaccessor-perl
libmoose-autobox-perl
libmoosex-app-cmd-perl
libmoosex-role-parameterized-perl
libmoosex-params-validate-perl
libmoosex-object-pluggable-perl
libmoosex-declare-perl
libmoosex-lazyrequire-perl
libmoosex-methodattributes
libmoosex-clone-perl
libmoosex-types-perl
libmoosex-types-path-class-perl

My question is, why do I get gibberish when I run code that uses the MooseX::* extentions? Is there a way to enable a silent mode? Using just Moose will not show anything else at output but the desired results, but here is what I get if I use MooseX::Declare :

$ ./myPerlProg.pl
The old Moose::Util::MetaRole API (before version 0.94) has been deprecated at /usr/local/lib/perl/5.10.1/Moose/Util/MetaRole.pm line 16
 Moose::Util::MetaRole::apply_metaclass_roles('for_class', 'MooseX::Method::Signatures', 'attribute_metaclass_roles', 'ARRAY(0x9ec2988)') called at /usr/share/perl5/MooseX/LazyRequire.pm line 15
 MooseX::LazyRequire::init_meta('MooseX::LazyRequire', 'for_class', 'MooseX::Method::Signatures', 'metaclass', undef) called at /usr/local/lib/perl/5.10.1/Moose/Exporter.pm line 355
 Moose::Exporter::__ANON__('MooseX::LazyRequire') called at /usr/share/perl5/MooseX/Method/Signatures.pm line 10
 MooseX::Method::Signatures::BEGIN() called at /usr/share/perl5/MooseX/LazyRequire.pm line 10
 eval {...} called at /usr/share/perl5/MooseX/LazyRequire.pm line 10
 require MooseX/Method/Signatures.pm called at /usr/share/perl5/MooseX/Declare/Syntax/MethodDeclaration.pm line 5
 MooseX::Declare::Syntax::MethodDeclaration::BEGIN() called at /usr/share/perl5/MooseX/LazyRequire.pm line 10
 eval {...} called at /usr/share/perl5/MooseX/LazyRequire.pm line 10
 require MooseX/Declare/Syntax/MethodDeclaration.pm called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 114
 Class::MOP::__ANON__() called at /usr/local/share/perl/5.10.1/Try/Tiny.pm line 71
 eval {...} called at /usr/local/share/perl/5.10.1/Try/Tiny.pm line 67
 Try::Tiny::try('CODE(0x9acde78)', 'Try::Tiny::Catch=REF(0x9a966a8)') called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 125
 Class::MOP::load_first_existing_class('MooseX::Declare::Syntax::MethodDeclaration') called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 137
 Class::MOP::load_class('MooseX::Declare::Syntax::MethodDeclaration', undef) called at /usr/local/lib/perl/5.10.1/Moose/Util.pm line 109
 Moose::Util::_apply_all_roles('Moose::Meta::Class=HASH(0x9ac6200)', undef, 'MooseX::Declare::Syntax::MethodDeclaration') called at /usr/local/lib/perl/5.10.1/Moose/Util.pm line 87
 Moose::Util::apply_all_roles('Moose::Meta::Class=HASH(0x9ac6200)', 'MooseX::Declare::Syntax::MethodDeclaration') called at /usr/local/lib/perl/5.10.1/Moose.pm line 58
 Moose::with('Moose::Meta::Class=HASH(0x9ac6200)', 'MooseX::Declare::Syntax::MethodDeclaration') called at /usr/local/lib/perl/5.10.1/Moose/Exporter.pm line 294
 Moose::with('MooseX::Declare::Syntax::MethodDeclaration') called at /usr/share/perl5/MooseX/Declare/Syntax/Keyword/MethodModifier.pm line 9
 require MooseX/Declare/Syntax/Keyword/MethodModifier.pm called at (eval 205) line 1
 MooseX::Declare::Syntax::MooseSetup::BEGIN() called at /usr/share/perl5/MooseX/LazyRequire.pm line 10
 eval {...} called at /usr/share/perl5/MooseX/LazyRequire.pm line 10
 eval 'package MooseX::Declare::Syntax::MooseSetup; use MooseX::Declare::Syntax::Keyword::MethodModifier;' called at /usr/share/perl5/aliased.pm line 50
 aliased::_load_alias('MooseX::Declare::Syntax::Keyword::MethodModifier', 'MooseX::Declare::Syntax::MooseSetup') called at /usr/share/perl5/aliased.pm line 20
 aliased::import('aliased', 'MooseX::Declare::Syntax::Keyword::MethodModifier') called at /usr/share/perl5/MooseX/Declare/Syntax/MooseSetup.pm line 8
 MooseX::Declare::Syntax::MooseSetup::BEGIN() called at /usr/share/perl5/MooseX/LazyRequire.pm line 10
 eval {...} called at /usr/share/perl5/MooseX/LazyRequire.pm line 10
 require MooseX/Declare/Syntax/MooseSetup.pm called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 114
 Class::MOP::__ANON__() called at /usr/local/share/perl/5.10.1/Try/Tiny.pm line 71
 eval {...} called at /usr/local/share/perl/5.10.1/Try/Tiny.pm line 67
 Try::Tiny::try('CODE(0x9ab31c8)', 'Try::Tiny::Catch=REF(0x9a8e398)') called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 125
 Class::MOP::load_first_existing_class('MooseX::Declare::Syntax::MooseSetup') called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 137
 Class::MOP::load_class('MooseX::Declare::Syntax::MooseSetup', undef) called at /usr/local/lib/perl/5.10.1/Moose/Util.pm line 109
 Moose::Util::_apply_all_roles('Moose::Meta::Class=HASH(0x9a054b8)', undef, 'MooseX::Declare::Syntax::MooseSetup', 'MooseX::Declare::Syntax::RoleApplication', 'MooseX::Declare::Syntax::Extending') called at /usr/local/lib/perl/5.10.1/Moose/Util.pm line 87
 Moose::Util::apply_all_roles('Moose::Meta::Class=HASH(0x9a054b8)', 'MooseX::Declare::Syntax::MooseSetup', 'MooseX::Declare::Syntax::RoleApplication', 'MooseX::Declare::Syntax::Extending') called at /usr/local/lib/perl/5.10.1/Moose.pm line 58
 Moose::with('Moose::Meta::Class=HASH(0x9a054b8)', 'MooseX::Declare::Syntax::MooseSetup', 'MooseX::Declare::Syntax::RoleApplication', 'MooseX::Declare::Syntax::Extending') called at /usr/local/lib/perl/5.10.1/Moose/Exporter.pm line 294
 Moose::with('MooseX::Declare::Syntax::MooseSetup', 'MooseX::Declare::Syntax::RoleApplication', 'MooseX::Declare::Syntax::Extending') called at /usr/share/perl5/MooseX/Declare/Syntax/Keyword/Class.pm line 7
 require MooseX/Declare/Syntax/Keyword/Class.pm called at (eval 1) line 1
 MooseX::Declare::BEGIN() called at /usr/share/perl5/MooseX/LazyRequire.pm line 10
 eval {...} called at /usr/share/perl5/MooseX/LazyRequire.pm line 10
 eval 'package MooseX::Declare; use MooseX::Declare::Syntax::Keyword::Class;' called at /usr/share/perl5/aliased.pm line 50
 aliased::_load_alias('MooseX::Declare::Syntax::Keyword::Class', 'MooseX::Declare') called at /usr/share/perl5/aliased.pm line 20
 aliased::import('aliased', 'MooseX::Declare::Syntax::Keyword::Class', 'ClassKeyword') called at /usr/share/perl5/MooseX/Declare.pm line 6
 MooseX::Declare::BEGIN() called at /usr/share/perl5/MooseX/LazyRequire.pm line 10
 eval {...} called at /usr/share/perl5/MooseX/LazyRequire.pm line 10
 require MooseX/Declare.pm called at ./myPerlProg10.pl line 3
 main::BEGIN() called at /usr/share/perl5/MooseX/LazyRequire.pm line 10
 eval {...} called at /usr/share/perl5/MooseX/LazyRequire.pm line 10
Variable "$class" is not imported at ./myPerlProg10.pl line 12.
+4  A: 

These are deprecation warnings (introduced in Moose 1.09). The extensions you're using (or your code itself) is using features that will be removed in some future version of Moose. If it's a MooseX extension that's causing the warning, look for an updated version. If it's your code, fix it.

For example, the first warning (about MooseX/LazyRequire.pm using the old Moose::Util::MetaRole API) should be fixed by installing MooseX::LazyRequire 0.06.

I see from your comment on mirod's answer that you installed Moose from CPAN but the MooseX modules from aptitude. That's what caused your problem; the version of Moose was too new for your extensions. Either install everything from CPAN, or everything from aptitude. Mixing CPAN and aptitude installs for closely-related modules like Moose and MooseX::* is likely to cause problems.

cjm
Excellent... I have removed all the packages related to moose and mooseX. However, I have installed perl via the package manager as well (perl, perl-base and perl-modules) and they are version: 5.10.1-8ubuntu2Should this cause a problem if I install Moose and MooseX from CPAN shell ?
Kaeso
@Kaeso, I don't think that should be a problem.
cjm
Also note that the "MooseX::* extensions" are by no means curated in anyway. They may or may not be up to date with the deprecations made by Moose. The Moose core team has no way (or desire) to enforce this beyond the measures we already take (which include testing changes with all downstream modules before a release, and informing the community at large of such changes).
perigrin