So I haven’t totally figured everything out about CGI::Application::Dispatch, but I am learning a lot. First off, here are two things that I learned today.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package ACD::Dispatch;
use base 'CGI::Application::Dispatch';
use warnings;

sub dispatch_args {
    return {
        prefix  => 'ACD',
        debug => 0,
        table   => [
            '/'  => {
                app => 'Welcome',
                rm => 'index'
            },
            # The rm must be optional if you want
            # /controller to go to the startrunmode.
            ':app/:rm?/:foo?' => { },
        ],
        args_to_new => {
            PARAMS => {
                cfg_file => '/path/to/config.pl',
            }
        },
    };
}

1;

Now, notice the :foo param. If you want to get access to that in your controller you use

1
$self->param('foo')

but if you had a regular parameter as well and wanted to get access to that, you’d use

1
$self->query->param('bar')