Skip to content

Instantly share code, notes, and snippets.

@zoffixznet

zoffixznet/pl.pl Secret

Created August 1, 2017 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoffixznet/f83662c0cb22deb1607fbc8db8d2f409 to your computer and use it in GitHub Desktop.
Save zoffixznet/f83662c0cb22deb1607fbc8db8d2f409 to your computer and use it in GitHub Desktop.
sub product {
my $self = shift;
my $product = $self->products->get($self->stash('number'))
or return $self->reply->not_found;
my @crumbs;
my $cat_url = '';
for my $subcat (split /\Q*::*\E/, $product->{category}) {
$cat_url .= "/$subcat";
push @crumbs, +{
url => $self->url_for('homecategory', category => $cat_url),
text => $subcat,
};
}
@crumbs[-1]{last} = 1;
$self->stash(
product => $product,
crumbs => \@crumbs,
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment