sub cost { return $_[0]->get_price(PriceType->COST_ID); } sub list_price { return $_[0]->get_price(PriceType->LIST_PRICE_ID); } sub sale_price { return $_[0]->get_price(PriceType->SALE_PRICE_ID); } sub get_price { my ($self, $id) = @_; return unless $id and $id =~ /^[[:digit:]]+$/; my $price_type = PriceType->retrieve($id); $self->_croak "PriceType ID ($id) unknown" unless $price_type; my $sth = $self->sql_find_price; $sth->execute($self->id, $id); my ($price) = $sth->fetchrow_array; $sth->finish(); return $price; }