Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ritorna un array di prodotti rappresentati
- # come hash da attributi del prodotto a valori
- sub get_products {
- my $product_list = get_list($products_xml);
- my @products = ();
- foreach my $p ($product_list->findnodes('//ns:product')) {
- my @ingredients = $p->findnodes("ns:ingredient_list//ns:ingredient");
- my %product = {
- 'product_id' => $p->findvalue('ns:product_id'),
- 'name' => $p->findvalue('ns:name'),
- 'description' => $p->findvalue('ns:description'),
- 'price' => $p->findvalue('ns:price'),
- 'picture' => img_path($p->findvalue('ns:picture')),
- 'ingredients' => @ingredients
- };
- push(%product, @products);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment