This is an horrible solution, because of duplicate attributes:
YAML file:
tmpPages:
- Page:
URL: http://www.perlmonks.org/
- Page:
URL: http://www.perl.org/
Objects container:
package PagesGenerator;
our $VERSION=0.01;
use Moose;
with 'MooseX::SimpleConfig';
use Page;
has 'tmpPages'=>(
is=>'rw',
isa=>'ArrayRef[HashRef]',
default => sub { [ ] },
);
has 'pages'=>(
is=>'rw',
isa=>'ArrayRef[Page]',
default => sub { [ ] },
);
sub BUILD{
my $self=shift;
@{$self->pages}= map {new Page(URL=>$$_{Page}{URL});} @{$self->tmp
+Pages};
for ( @{ $self->pages } ) {
print $_->URL;
print "\n";
}
}
Any other idea?