Hi Vitaliy,

> #run-mode:module:sub
> 1:Module01:hello
> 2:Module01:show_some_form
> 3:Module02:show_another_form
> 4:Module03:do_something
>
> Which means if we call script.cgi?rm=2, sub show_some_form() from Module01.pm
> should be executed.

One way to handle a large CGI::Application is to break it into a bunch of
smaller ones.  For instance in an app with admin sections for managing users,
groups and documents, you could have three different applications:

    users.cgi      (uses My::Users.pm)
    groups.cgi     (uses My::Groups.pm)
    documents.cgi  (uses My::Documents.pm)

Then you have appropriate run modes within each application (e.g. each of the
applications probably has an 'add' run mode).  All of the application modules
inherit from a common base class.  The base class handles things like settings,
sessions, and run modes that are common across applications.

At the moment, I'm looking at a related issue, which is how to translate
human-readable urls into script/runmode combinations.

For instance, I would like to translate:

    /admin/users/add.shtml

into:

    /cgi-bin/users.cgi?rm=add

This can be done with an Apache rewrite rule, or with a mod_perl handler
(something like Apache::Dispatch).  But it also might work with a table-based
dispatch mechanism like the one you are talking about.


Michael


--
Michael Graham
[EMAIL PROTECTED]

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to