WWW::Restaurant::Menu - An abstract Perl base class for querying online menus of restaurants.
0.11
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;
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}; }
This is an abstract Perl base class for querying online menus of restaurants. It should be sub-classed for functionality specific to restaurants.
The following constructor is provided:
Creates a new WWW::Restaurant::Menu object from the given options. No options are supported by this base class.
WWW::Restaurant::Menu
The following instance methods are provided:
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.
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.
Returns a string denoting the currency of the item prices on the menu.
For COPYRIGHT and LICENSE information, see WWW::Restaurant::Menu::Overview.
Julian Mehnle <julian@mehnle.net>
To install WWW::Restaurant::Menu, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Restaurant::Menu
CPAN shell
perl -MCPAN -e shell install WWW::Restaurant::Menu
For more information on module installation, please visit the detailed CPAN module installation guide.