Hi,

I got an exception when using 'after' this way.
Here is my Moose class :

package Myclass;

use Moose;
extends 'SuperClass';
with 'MyRole';

has 'file' => (is => 'rw', isa => 'Str', required => 1);
has 'fh'   => (is => 'rw', isa => 'FileHandle');

after 'new' => sub {
   my $self = shift;
   my $file = $self->file();
   $self->set_fh($self->open_file($file)); # Returns a FileHandle obj
   return 0;
};

1;


Later when I use my Class, I get the following error :

my $c = MyClass->new(file => '/tmp/foobar');

Can't use string ("MyClass") as a HASH ref while "strict refs" in use at accessor MyClass::file (defined at /home/tuco/src/workspace/cnvdb/script/../lib/Class.pm line 7)



Can someone light my lantern?

Sorry for the stupid question

Regards


--
-------------------------
Emmanuel Quevillon
CIB, Centre Informatique pour la Biologie
Institut Pasteur
+33 1 44 38 95 98
tuco at_ pasteur dot fr
-------------------------

Reply via email to