Skip to content

Instantly share code, notes, and snippets.

@edenc
Created January 23, 2013 19:55
Show Gist options
  • Select an option

  • Save edenc/4612274 to your computer and use it in GitHub Desktop.

Select an option

Save edenc/4612274 to your computer and use it in GitHub Desktop.
my $cat = $cat_rs->find(1);
$cat->config($config);
$cat->get_product(1);
sub config {
# ler config do disco aqui
}
sub get_product {
my($self, $sku) = @_;
my $prod = $self->products->find({sku => 1});
$self->mangle_discount($prod);
return $prod;
}
sub mangle_discount {
my($self, $prod) = @_;
$prod->discount(0) unless
$prod->discount < $self->config->{max});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment