develooper Front page | perl.moose | Postings from July 2011

RE: Using Moose with Expect.pm

Thread Previous
From:
arne.romo
Date:
July 18, 2011 16:19
Subject:
RE: Using Moose with Expect.pm
Message ID:
882B6002F8A2FC4883708E8399C037EB638922A548@GVW1092EXB.americas.hpqcorp.net
It works now.

I had to install both
	MooseX::NonMoose::InsideOut
     And
	MooseX::InsideOut

When I installed only MooseX::NonMoose::InsideOut I got the following.
Thanks for your quick/kind response.

	-Arne

$ perl -e 'use c; $a = c->new( host => "fred" );  print $a->name '
Can't locate MooseX/InsideOut/Role/Meta/Instance.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .). at /usr/local/lib64/perl5/Class/MOP.pm line 135
	Class::MOP::load_first_existing_class('MooseX::InsideOut::Role::Meta::Instance') called at /usr/local/lib64/perl5/Class/MOP.pm line 140
	Class::MOP::load_class('MooseX::InsideOut::Role::Meta::Instance', undef) called at /usr/local/lib64/perl5/Moose/Util.pm line 131
	Moose::Util::_apply_all_roles('Moose::Meta::Class=HASH(0x25d0fc0)', undef, 'MooseX::InsideOut::Role::Meta::Instance') called at /usr/local/lib64/perl5/Moose/Util.pm line 98
	Moose::Util::apply_all_roles('Moose::Meta::Class=HASH(0x25d0fc0)', 'MooseX::InsideOut::Role::Meta::Instance') called at /usr/local/lib64/perl5/Moose/Meta/Class.pm line 104
	Moose::Meta::Class::create('Moose::Meta::Class', 'Moose::Meta::Class::__ANON__::SERIAL::3', 'roles', 'ARRAY(0x2548438)', 'weaken', '', 'superclasses', 'ARRAY(0x2548450)') called at /usr/local/lib64/perl5/Class/MOP/Package.pm line 121
	Class::MOP::Package::create_anon('Moose::Meta::Class', 'superclasses', 'ARRAY(0x2548450)', 'roles', 'ARRAY(0x2548438)', 'cache', 1) called at /usr/local/lib64/perl5/Class/MOP/Class.pm line 473
	Class::MOP::Class::create_anon_class('Moose::Meta::Class', 'superclasses', 'ARRAY(0x2548450)', 'roles', 'ARRAY(0x2548438)', 'cache', 1) called at /usr/local/lib64/perl5/Moose/Util/MetaRole.pm line 134
	Moose::Util::MetaRole::_make_new_class('Moose::Meta::Instance', 'ARRAY(0x2548438)') called at /usr/local/lib64/perl5/Moose/Util/MetaRole.pm line 95
	Moose::Util::MetaRole::_make_new_metaclass('Moose::Meta::Class=HASH(0x2403378)', 'HASH(0x2548480)', 'class') called at /usr/local/lib64/perl5/Moose/Util/MetaRole.pm line 28
	Moose::Util::MetaRole::apply_metaroles('for', 'c', 'class_metaroles', 'HASH(0x2548480)') called at /usr/local/lib64/perl5/Moose/Exporter.pm line 624
	Moose::Exporter::__ANON__('MooseX::NonMoose::InsideOut', 'for_class', 'MooseX::NonMoose::Meta::Role::Constructor', 'metaclass', undef, 'meta_name', 'meta') called at /usr/local/share/perl5/MooseX/NonMoose/InsideOut.pm line 24
	MooseX::NonMoose::InsideOut::init_meta('MooseX::NonMoose::InsideOut', 'for_class', 'MooseX::NonMoose::Meta::Role::Constructor', 'metaclass', undef, 'meta_name', 'meta') called at /usr/local/lib64/perl5/Moose/Exporter.pm line 420
	Moose::Exporter::__ANON__('MooseX::NonMoose::InsideOut') called at c.pm line 4
	c::BEGIN() called at /usr/local/share/perl5/MooseX/NonMoose/InsideOut.pm line 4
	eval {...} called at /usr/local/share/perl5/MooseX/NonMoose/InsideOut.pm line 4
	require c.pm called at -e line 1
	main::BEGIN() called at /usr/local/share/perl5/MooseX/NonMoose/InsideOut.pm line 4
	eval {...} called at /usr/local/share/perl5/MooseX/NonMoose/InsideOut.pm line 4
BEGIN failed--compilation aborted at c.pm line 4.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

-----Original Message-----
From: Jesse Luehrs [mailto:doy@tozt.net] 
Sent: Monday, July 18, 2011 4:46 PM
To: moose@perl.org
Subject: Re: Using Moose with Expect.pm

On Mon, Jul 18, 2011 at 10:18:25PM +0000, Arne Romo wrote:
> I need help understanding how to use Moose to "extend" Expect.pm.
> It occurred to me that since Expect.pm is a non-moose module I need the
>     "use MooseX::NonMoose;"
> but my simple test program still fails.
> 
> Below I've include my simple perl script showing it fail when I use the
> "extends" and passing if I comment out the "extends".
> Clearly I'm missing something or need some higher level kungfu here 8)
> 
> Any help / simple working example would be greatly appreciated.
> This is my first foray into the Moose world so I'm just starting to learn
> this critter.
>     -Arne

Expect.pm doesn't use hashrefs for objects, so you need to tell Moose
how to handle that. The easiest way is to use
MooseX::NonMoose::InsideOut rather than MooseX::NonMoose.

-doy

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