in reply to Re^2: Moose from ArrayRef[HashRef] to ArrayRef[Object]
in thread Moose from ArrayRef[HashRef] to ArrayRef[Object]
Objects container:tmpPages: - Page: URL: http://www.perlmonks.org/ - Page: URL: http://www.perl.org/
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"; } }
|
|---|