in reply to Moose, Class::DBI, and builder
Yes, it should be built when the method is called. You are accessing the attribute element directly instead of calling the method on the object.
Which ultimately fails because of the same mistake here:print "\$obj->{'manual_pnone'} " . $obj->{'manual_phone'} . "\n"; # wr +ong # as opposed to print "\$obj->manual_pnone " . $obj->manual_phone . "\n"; # correct
Always use accessors unless you are in the package that defines the element. (And many would argue you should do so even there.)sub _build_manual_phone { my $self = shift; if (! defined $self->{merch_info}) { die "ERROR: merch_info not defined\n"; } return $self->{merch_info}->MANUAL_NUMBER; }
Update: I would also double check the case of the column names. Are they really being stored in "merch_info" as upper case?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Moose, Class::DBI, and builder
by perldiverx (Beadle) on Jul 10, 2014 at 19:36 UTC |