Help for this page

Select Code to Download


  1. or download this
    package PriceType;
    use base qw(Class::Singleton);
    ...
        my $id = $id;
        { no strict 'refs'; *{$method} = sub { $id } };
    };
    
  2. or download this
    sub get_price {
       my ($self, $price_type) = @_;
    ...
       my ($price) = $sth->fetchrow_array;
       return $price;
    }
    
  3. or download this
    my $cost = $product->cost;
    my $list = $product->list_price;
    my $sale = $product->sale_price;
    
  4. or download this
    my $cost = $product->price(PriceType::Cost->instance);
    my $list = $product->price(PriceType::ListPrice->instance);
    my $sale = $product->price(PriceType::SalePrice->instance);
    
  5. or download this
    my $cost = PriceType::Cost->instance->get_price($product);
    my $list = PriceType::ListPrice->instance->get_price($product);
    my $sale = PriceType::SalePrice->instance->get_price($product);