GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
CGI::Application::Dispatch::Regexp(3) User Contributed Perl Documentation CGI::Application::Dispatch::Regexp(3)

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

    use CGI::Application::Dispatch::Regexp;

    CGI::Application::Dispatch::Regexp->dispatch(
        prefix  => 'MyApp',
        table   => [
            ''                                    => { app => 'Welcome',
                                                       rm  => 'start',
                                                     },
            qr|/([^/]+)/?|                        => { names => ['app'],
                                                     },
            qr|/([^/]+)/([^/]+)/?|                => { names =>
                                                         [qw(app rm)]
                                                     },
            qr|/([^/]+)/([^/]+)/page(\d+)\.html?| => { names =>
                                                         [qw(app rm page)]
                                                     },
        ],
    );

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

The dispatch table should contain list of regular expressions with hashref of corresponding parameters. Hash element 'names' is a list of names of regular expression groups. The default table looks like this:

        table       => [
            qr|/([^/]+)/?|          => { names => ['app']      },
            qr|/([^/]+)/([^/]+)/?|  => { names => [qw(app rm)] },
        ],

Here's an example of defining a custom 'page' parameter:

        qr|/([^/]+)/([^/]+)/page(\d+)\.html/?| => {
            names => [qw(app rm page)],
        },

Copyright Michael Peters and Mark Stosberg 2008, all rights reserved.

CGI::Application, CGI::Application::Dispatch
2022-04-08 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.