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

Using Moose with Expect.pm

Thread Next
From:
Arne Romo
Date:
July 18, 2011 15:40
Subject:
Using Moose with Expect.pm
Message ID:
loom.20110719T000756-590@post.gmane.org
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

$ cat e.pm
package e;

use Moose;
use MooseX::NonMoose;
extends 'Expect';

has 'user'     => ( is => 'rw', isa => 'Str', default  => 'Acme' );

1;
$ perl -e 'use e; $a = e->new();  print $a->dump '
Not a HASH reference at /usr/local/lib/perl/5.10.1/Class/MOP/Instance.pm line 
129.
$ 
$ 
$ vi e.pm
$ cat e.pm
package e;

use Moose;
use MooseX::NonMoose;
#	extends 'Expect';

has 'user'     => ( is => 'rw', isa => 'Str', default  => 'Acme' );

1;
$ perl -e 'use e; $a = e->new();  print $a->dump '
$VAR1 = bless( {
                 'user' => 'Acme'
               }, 'e' );



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About