NAME

CGI::Dispatcher::Simple - Simple CGI Dispacher by PATH_INFO

SYNOPSIS

  # In your App

  package MyApp;
  use base qw/CGI::Dispacher::Simple/;

  sub run {
      my $self = shift;

      $self->dispatch({
          '/' => 'default',
          '/list' => 'list',
          '/add' => 'add',
      });
  }

  sub default {
      :
  }

   :

  # And in your CGI script

  my $app = MyApp->new;
  $app->run;

DESCRIPTION

This module provide you to simple dispatcher by using PATH_INFO.

You can set some methods as hashref, PATH_INFO are keys, METHODS are values. like:

  '/' => 'default',
  '/list/add' => 'add',

And, rest of PATH_INFO is saved in $self->args as arrayref. When PATH_INFO is '/list/add/foo/bar' in above example, $self->args is:

  [ 'foo', 'bar' ]

If you define $self->begin or $self->end methods, these are called automatically before/after PATH_INFO method.

And when PATH_INFO is not defined, dispatch to '/' method.

METHODS

new
dispatch

AUTHOR

Daisuke Murase <typester@cpan.org>

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.