Hi Amazing. I don't get it get.
On 12/12/12 01:29, Mark Stosberg wrote: > On 12/10/2012 06:05 PM, Ron Savage wrote: >> Hi Mark >> >> On 11/12/12 08:38, Mark Stosberg wrote: >>> On 12/10/2012 04:27 PM, Ron Savage wrote: >>>> Hi Mark >>>> >>>> Ah, yes. No 'use Moo', means new() is not generated, so you don't end up >>>> with a class. >>> >>> And the class-less-ness makes it a problem for putting BUILD in a >>> Moo::Role? >> >> Yes. The role has a BUILD() from when it was a class: >> >> Can't locate object method "new" via package "Local::Config" at >> scripts/test.config.pl line 17. > > I just tried putting together a Moo::Role with a BUILD method in it, and > it worked... producing the same result as Moose did. > > See here: > > ### > > use 5.14.0; > > package My::Moose::Role { > use Moose::Role; > sub BUILD { shift->result("in My Role") } > } > package My::Moose { > use Moose; > has 'result' => (is => 'rw'); > with 'My::Moose::Role'; > } > package My::Moo::Role { > use Moo::Role; > sub BUILD { shift->result("in My Role") } > } > package My::Moo { > use Moo; > has 'result' => (is => 'rw'); > with 'My::Moo::Role'; > } > > use Test::More; > > my $moose = My::Moose->new; > my $moo = My::Moo->new; > > is($moose->result,$moo->result, > "Moose and Moose support BUILD in roles the same?"); > > done_testing(); > > ### -- Ron Savage http://savage.net.au/ Ph: 0421 920 622 ##### CGI::Application community mailing list ################ ## ## ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp ## ## ## ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ## ## ################################################################