1CGI::Application::DispaUtscehr::CRoengterxipb(u3t)ed PerClGID:o:cAupmpelnitcaattiioonn::Dispatch::Regexp(3)
2
3
4

NAME

6       CGI::Application::Dispatch::Regexp - Dispatch requests to
7       CGI::Application based objects using regular expressions
8

SYNOPSIS

10           use CGI::Application::Dispatch::Regexp;
11
12           CGI::Application::Dispatch::Regexp->dispatch(
13               prefix  => 'MyApp',
14               table   => [
15                   ''                                    => { app => 'Welcome',
16                                                              rm  => 'start',
17                                                            },
18                   qr|/([^/]+)/?|                        => { names => ['app'],
19                                                            },
20                   qr|/([^/]+)/([^/]+)/?|                => { names =>
21                                                                [qw(app rm)]
22                                                            },
23                   qr|/([^/]+)/([^/]+)/page(\d+)\.html?| => { names =>
24                                                                [qw(app rm page)]
25                                                            },
26               ],
27           );
28

DESCRIPTION

30       CGI::Application::Dispatch uses its own syntax dispatch table.
31       "CGI::Application::Dispatch::Regexp" allows one to use flexible and
32       powerful Perl regular expressions to transform a path into argument
33       list.
34

DISPATCH TABLE

36       The dispatch table should contain list of regular expressions with
37       hashref of corresponding parameters. Hash element 'names' is a list of
38       names of regular expression groups. The default table looks like this:
39
40               table       => [
41                   qr|/([^/]+)/?|          => { names => ['app']      },
42                   qr|/([^/]+)/([^/]+)/?|  => { names => [qw(app rm)] },
43               ],
44
45       Here's an example of defining a custom 'page' parameter:
46
47               qr|/([^/]+)/([^/]+)/page(\d+)\.html/?| => {
48                   names => [qw(app rm page)],
49               },
50
52       Copyright Michael Peters and Mark Stosberg 2008, all rights reserved.
53

SEE ALSO

55       CGI::Application, CGI::Application::Dispatch
56
57
58
59perl v5.32.1                      2021-01-C2G6I::Application::Dispatch::Regexp(3)
Impressum