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


CGI-Dispatcher-Simple documentation  | view source Contained in the CGI-Dispatcher-Simple distribution.

Index


NAME

Top

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

SYNOPSIS

Top

  # 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

Top

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

Top

new
dispatch

AUTHOR

Top

Daisuke Murase <typester@cpan.org>

COPYRIGHT

Top


CGI-Dispatcher-Simple documentation  | view source Contained in the CGI-Dispatcher-Simple distribution.