Created
January 23, 2013 19:55
-
-
Save edenc/4612274 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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