Help for this page

Select Code to Download


  1. or download this
    use Food::Product;
    my $p = new Food::Product('Tomato')
       or die("Could not instance Food::Product: ($Food::Product::errstr)"
    +);
    ...
    $p->stock(450);
    $p->sell(450) or die($p->errstr);
    $p->sell(40) or die($p->errstr);
    
  2. or download this
    package Food::Product;
    use strict;
    ...
       $self->stock($left_over);
    }