NAME

EntityModel::Web::Site

VERSION

version 0.004

SYNOPSIS

my $web = EntityModel::Web->new;
my $req = EntityModel::Web::Request->new;
my $site = $web->find_site('somehost.example.com');
my $page = $site->find_page('http://somehost.example.com/some/page');
my $response = $page->handle_request($req);

DESCRIPTION

The site maintains a path map for string and regex paths:

string => {
 index.html			=> {},
 documentation/index.html	=> {},
},
regex => [
 tutorial/([^/]+)/perl.html	=> {}
]

When parsing a new page entry, the "full_path" method is used to identify the entry to use for the path map.

The / delimiter is added automatically unless the pathseparator parameter is given, in which case this value will be used instead (can be used for cases such as page_(one|two|three).html.

Any path that matches a string path exactly (via hash lookup) will return that page without further checks. If this match fails, the string is compared against the regex entries. Normally top-level pages should be anchored to the start of the string.

Using a prefix substring match may help for performance, although this would need to limit to non-metachars only and only applies to the start-anchored regex entries.

METHODS

page_from_uri

In list context, returns the captured regex elements if we had any.

AUTHOR

Tom Molesworth <cpan@entitymodel.com>

LICENSE

Copyright Tom Molesworth 2009-2011. Licensed under the same terms as Perl itself.