NAME
Egg::Plugin::Dispatch::AnyCall - The Dispatch function for Egg is supplemented.
SYNOPSIS
package MYPROJECT;
use strict;
use Egg qw/Dispatch::AnyCall/;Dispatch example.
__PACKAGE__->run_modes(
  _default=> sub {
    my($dispat, $e)= @_;
    $e->call_to('Home');
    },
  );Dispatch sub class example.
package MYPROJECT::D::Home;
use strict;
sub index {
  my($dispat, $e)= @_;
  $e->response->body('is index.');
}
sub hoge {
  my($dispat, $e)= @_;
  .....
  $e->response->body('is hoge hoge.');
}Request example.
htto://domain.name/
             => Display : is index.
htto://domain.name/
             => Display : is hoge hoge.DESCRIPTION
This module supplements handling '_default' key to run_modes that Egg::Dispatch::Runmode treats.
Egg::Dispatch::Runmode starts making it match to '_default' compared with the request of the type not defined in run_modes. This module guesses the dispatch method that calls from the request to '_default'.
package MYPROJECT::D::Booo;
use strict;
sub foo {
  my($dispat, $e)= @_;
  $e->response->body('is foo.');
}
sub hoo {
  my($dispat, $e)= @_;
  $e->response->body('is hoo.');
}To the subdispatch like the above-mentioned when run_modes is as follows.
__PACKAGE__->run_modes(
  _default=> sub {},
  home=> {
    _default=> sub {
      my($dispat, $e)= @_;
      $e->call_to('Booo');
      },
    },
  );This is answered to each request as follows.
http://domain/
            => index.tt (content of template)
http://domain/home
            => NOT FOUND.
http://domain/home/foo
            => 'is foo.'
http://domain/home/hoo
            => 'is hoo.'To return http://domain/home the content of the template as usual, it only has to define neither the template nor response->body by the subdispatch.
sub index {}It comes to evaluate home/index.tt to http://domain/home by this.
METHODS
call_to ([DISPATCH_NAME], [DEFAULT_METHOD])
The method corresponding to request URI is called reading the specified dispatch.
[DISPATCH_NAME] is modified by [project_name]::D. For instance, if it is 'BanBan', MYPROJECT::D::BanBan is read. Moreover, when [DISPATCH_NAME] is omitted, MYPROJECT::D is an object.
When [DISPATCH_NAME] starts by +, the continuing name is treated as a module name. For instance '+ORIGN::Dispatch' reads ORIGN::Dispatch.
[DEFAULT_METHOD] is a method name used when the call corresponding to the request fails. As for this, 'template_default_name' is used usually.
SEE ALSO
Egg::Dispatch::Runmode Egg::Release,
AUTHOR
Masatoshi Mizuno <lushe@cpan.org>
COPYRIGHT
Copyright (C) 2007 by Bee Flag, Corp. <http://egg.bomcity.com/>, All Rights Reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.