saintex has asked for the wisdom of the Perl Monks concerning the following question:
pages: - Page: URL: http://www.perlmonks.org/ - Page: URL: http://www.perl.org/
package Page; our $VERSION=0.01; use Moose; has 'URL' => (is => 'ro', isa => 'Str',required => 1); __PACKAGE__->meta->make_immutable; 1;
package PagesGenerator; our $VERSION=0.01; use Moose; with 'MooseX::SimpleConfig'; use Page; has 'pages'=>( is=>'rw', isa=>'ArrayRef[Page]', default => sub { [ ] }, ); __PACKAGE__->meta->make_immutable; 1;
But, while page is an ArrayRef[Page] I have this error:use strict; use warnings; our $VERSION=0.01; use FindBin qw($Bin); my $p=PagesGenerator->new_with_config(configfile => "$Bin/pages-temp.y +aml");
Attribute (pages) does not pass the type constraint because: Validatio +n failed for 'ArrayRef[Page]' with value ARRAY(0x22422e8) at /usr/loc +al/share/perl/5.10.0/MooseX/ConfigFromFile.pm line 44 MooseX::ConfigFromFile::new_with_config('PagesGenerator', 'configf +ile', 'pages-temp.yaml') called at navigator.pl line 14
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Moose from ArrayRef[HashRef] to ArrayRef[Object]
by ikegami (Patriarch) on Feb 23, 2011 at 15:27 UTC | |
by saintex (Scribe) on Feb 23, 2011 at 16:10 UTC | |
by ikegami (Patriarch) on Feb 23, 2011 at 18:44 UTC | |
by saintex (Scribe) on Feb 23, 2011 at 22:50 UTC | |
by saintex (Scribe) on Feb 24, 2011 at 09:16 UTC | |
by ikegami (Patriarch) on Feb 24, 2011 at 15:59 UTC | |
by ikegami (Patriarch) on Feb 23, 2011 at 18:23 UTC | |
by saintex (Scribe) on Feb 23, 2011 at 17:06 UTC |