NAME

Apache2::Controller::Dispatch::RenderTemplate - dispatch to controllers mapped by files in primary A2C_Render_Template_Path.

VERSION

Version 1.000.100

SYNOPSIS

UNIMPLMENTED - AN AMBITIOUS AND INTERESTING SPEC

I am going on to write OpenID auth first but this is an idea for an automatic dispatcher based on the template directory tree structure.

You do not need to subclass this A2C dispatch class. It assumes controller library structure from the structure of html template files and renders them with Apache2::Controller::Render::Template.

# virtualhost.conf:
PerlSwitches -I/myapp/lib

<Location '/'>

    # primary path looks like a web site; secondary 'cmp' = component templates:
    A2C_Render_Template_Path   /myapp/html   /myapp/cmp

    # what lib name do we prefix to the ucfirst()ed primary html files?
    A2CControllerLibs       MyApp::C

    # set and go:
    SetHandler              modperl
    PerlInitHandler         Apache2::Controller::Dispatch::RenderTemplate

</Location>
# EOF

shell% find /myapp -type f
/myapp/cmp/loginbox.html
/myapp/cmp/newsticker.html
/myapp/cmp/quickmenu.html
/myapp/html/index.html
/myapp/html/foo.html
/myapp/html/foo/biz.html
/myapp/html/foo/baz.html
/myapp/lib/MyApp/C/Foo.pm
/myapp/lib/MyApp/C/Noz.pm

Except, you do not type the '.html' in the URL. They are named so that you can easily look at the raw files with a local browser.

A URL with a corresponding file in /myapp/html will always render, whether a specific controller is found or not.

Foo      allowed_methods() is qw( default bar biz )
Noz      allowed_methods() is qw( default )

/              => index.html, no controller 
                        ( would be MyApp::C::Default->default() )

/yip           => index.html, no controller
                        ( would be MyApp::C::Default->yip() or default() )

/foo           => foo.html,        MyApp::C::Foo->default()

/foo/bar       => foo.html,        MyApp::C::Foo->bar()
/foo/bar/a/b/c => foo.html,        MyApp::C::Foo->bar(qw( a b c ))

/foo/biz/a/b/c => foo/biz.html,    MyApp::C::Foo->biz(qw( a b c ))

# cuts 'baz' from args because baz.html gets used:
/foo/baz/a/b/c => foo/baz.html,    MyApp::C::Foo->default(qw( a b c )) 

/noz/a/b/c     => index.html,      MyApp::C::Noz->default(qw( a b c ))

METHODS

handler

THIS MODULE IS UNIMPLEMENTED.

SEE ALSO

Apache2::Controller::Dispatch

Apache2::Controller

AUTHOR

Mark Hedges, hedges +(a t)- scriptdolphin.org

COPYRIGHT AND LICENSE

Copyright 2008 Mark Hedges. CPAN: markle

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

This software is provided as-is, with no warranty and no guarantee of fitness for any particular purpose.