NAME

WWW::Restaurant::Menu - An abstract Perl base class for querying online menus of restaurants.

VERSION

0.11

SYNOPSIS

Online restaurant menu querying:

use WWW::Restaurant::Menu;

# Construction:
my $menu = WWW::Restaurant::Menu->new(%options);

# Get all menu items, in order:
my @items       = $menu->items;

# Get menu items by class:
my @starters    = $menu->starters;
my @meals       = $menu->meals;
my @desserts    = $menu->desserts;
my @drinks      = $menu->drinks;

# Get currency of item prices:
my $currency    = $menu->currency;

Deriving new restaurant menu classes:

package WWW::Restaurant::<CC>::<City>::<Restaurant>::Menu[::<Submenu>];
# CC          ISO 3166 "alpha 2" country code
#             <http://ftp.ics.uci.edu/pub/ietf/http/related/iso3166.txt>.
# City        Name of the city where the restaurant is located.
# Restaurant  Name of the restaurant (unique within that city, if possible).
# Submenu     A special menu, like "Breakfast", "Lunch", "HappyHour"...

use base qw(WWW::Restaurant::Menu);

sub currency {
    return "$some_currency";  # Return currency of item prices.
}

sub query {
    my ($self) = @_;
    # Populate $self->{items} with WWW::Restaurant::Menu::Item objects:
    ...
    return $self->{items};
}

DESCRIPTION

This is an abstract Perl base class for querying online menus of restaurants. It should be sub-classed for functionality specific to restaurants.

Constructor

The following constructor is provided:

new(%options): RETURNS WWW::Restaurant::Menu

Creates a new WWW::Restaurant::Menu object from the given options. No options are supported by this base class.

Instance methods

The following instance methods are provided:

items: RETURNS (WWW::Restaurant::Menu::Item, ...)

Returns a list of WWW::Restaurant::Menu::Item (or derivative) objects representing all the items on this menu, in the order they appear on the menu.

starters: RETURNS (WWW::Restaurant::Menu::Item::Starter, ...)
meals: RETURNS (WWW::Restaurant::Menu::Item::Meal, ...)
desserts: RETURNS (WWW::Restaurant::Menu::Item::Dessert, ...)
drinks: RETURNS (WWW::Restaurand::Menu::Item::Drink, ...)

Returns a list of objects representing the items of the requested class that are on this menu, in the order they appear on the menu.

currency: RETURNS SCALAR

Returns a string denoting the currency of the item prices on the menu.

SEE ALSO

For COPYRIGHT and LICENSE information, see WWW::Restaurant::Menu::Overview.

AUTHOR

Julian Mehnle <julian@mehnle.net>