[cgiapp] catalyst.pl for CGI::App? Yes:
Module::Starter::Plugin::CGIApp
Jaldhar H. Vyas
jaldhar at braincells.com
Thu Jun 19 17:10:43 EDT 2008
On Wed, 18 Jun 2008, Mark Stosberg wrote:
>
> Just today at YAPC, several CGI::App people met in person and was
> saything that something like "catalyst.pl" would be nice for CGI::App.
> Then Perrin mentioned it would be nice to have a Module::Starter plugin
> for CGI::App. As I (belatedly) just discovered today, we already have
> one!
>
> Module::Starter::Plugin::CGIApp is on CPAN now.
>
Regretfully my plans to attend YAPC fell through. One of the things I was
hoping to do is to meet up with other CGI::App people and ask for
suggestions to improve M::S::P::CGIApp.
> It could be a little clearer how to use it. Here's an example that
> worked for me:
>
> MODULE_TEMPLATE_DIR=/usr/local/share/perl/5.8.8/Module/Starter/Plugin/CGIApp/templates/ module-starter --plugin Module::Starter::Simple --plugin Module::Starter::Plugin::Template --plugin Module::Starter::Plugin::CGIApp --module=MyApp --author=markstos --email=mark at summersault.com
>
I define options in a config file called ~/.module-starter/cgiapp/config
(I have a different config for non-CGIApp modules) and then call
module-starter like this:
MODULE_STARTER_DIR=~/.module-starter/cgiapp module-starter --module Module::Name
> This is a nice start, but could be improved in a couple way:
>
> - The default template directory should work automatically.
>
> - "--template_dir" should work as alternative to the env variable,
>
You can set template_dir in the config file. I recommend copying the
default templates and customizing them with your own style. E.g.
template_dir: ~/.module-starter/cgiapp/templates
> - The plugins shouldn't have to be named.
>
You can specify plugins in your config like so:
plugins: Module::Starter::Simple Module::Starter::Plugin::Template Module::Starter::Plugin::CGIApp
> Then, if my author and e-mail are in a config file as the should be,
> that leaves only one argument left: the module name.
>
Yes they can be included in the config too as well.
author: Jaldhar H. Vyas
email: jaldhar at braincells.com
I also have:
builder: Module::Build
Unfortunately the module-starter script is not extensible. Ricardo was
talking about reimplementing it using App::Command but I don't think he
has got around to it yet. Which is too bad because I think it would be
neat to have a --with-plugins option (and config setting) so you could
do e.g.:
--with-plugins=dbh,session,redirect
etc. to get your favorite CGI::App plugins added to the module skeleton.
> One more point of feedback:
>
> I thought it would be useful if the application when ahead and created
> www/cgi-bin/myapp.cgi
>
> Ideally, so it could be immediately run and tested.
Yes for the next go around I was thinking of adding this and a script that
uses CGI::Application::Server to run it.
Thanks for the feedback Mark. Please feel free to file bugs in rt id you
have other ideas (or patches or documentation!)
--
Jaldhar H. Vyas <jaldhar at braincells.com>
More information about the cgiapp
mailing list