Skip to content

Instantly share code, notes, and snippets.

View diegok's full-sized avatar

Diego Kuperman diegok

View GitHub Profile
@diegok
diegok / ean_lookup.pl
Created December 4, 2012 10:41 — forked from audreym/ean_lookup
test for ean price lookup
#!/usr/bin/env perl
use 5.10.0;
use strict;
use Supers::Schema;
use Text::CSV;
use utf8;
use Encode;
use Excel::Writer::XLSX;
use Data::Types;
binmode(STDOUT, ":utf8");
sub extract_subcategories {
my ($c, $slug_param, $categories, $facets) = @_;
return [] unless @$categories;
my ($cref) = ref($c) =~ m/::(\w+)$/;
my $level = split '/', $slug_param;
my $slg = Supers::Slugify->new;
my $subcats = [];
my $slug_re = qr/^$slug_param/;
@diegok
diegok / gist:3900950
Created October 16, 2012 18:06
split!
my $slug = "bebe/mas/cosas/t/tag";
my ($real_slug, $rest) = $slug =~ m|^(.+?)(/[mt]/.*)?$|
# con tu ejemplo:
my ($real_slug) = $slug =~ /((?!\/[tm]).+)/