RFC: Module::Starter::Plugin::CGIApp

View: New views
16 Messages — Rating Filter:   Alert me  

RFC: Module::Starter::Plugin::CGIApp

by Jaldhar H. Vyas-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've been playing with Module::Starter recently and I wrote a plugin which
creates a basic CGI::Application based module.  It should be wending its
way to CPAN as we speak.

What do you think?  I would appreciate any comments, bug reports or
patches.  In particular I am interested in implementing as many "best
practices" as possible.

--
Jaldhar H. Vyas <jaldhar@...>

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: RFC: Module::Starter::Plugin::CGIApp

by Ron Savage :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jaldhar

On Sun, 2008-03-23 at 10:26 -0400, Jaldhar H. Vyas wrote:
> I've been playing with Module::Starter recently and I wrote a plugin which
> creates a basic CGI::Application based module.  It should be wending its
> way to CPAN as we speak.

It'd be easier to find if we knew its name...

> What do you think?  I would appreciate any comments, bug reports or
> patches.  In particular I am interested in implementing as many "best
> practices" as possible.

It needs to go further than just automatically writing code - it needs
to automatically debug it as well :-)).
--
Ron Savage
ron@...
http://savage.net.au/index.html



#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: RFC: Module::Starter::Plugin::CGIApp

by Jaldhar H. Vyas-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 24 Mar 2008, Ron Savage wrote:

> It'd be easier to find if we knew its name...
>

Module::Starter::Plugin::CGIApp

as in the subject :-)

--
Jaldhar H. Vyas <jaldhar@...>

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: RFC: Module::Starter::Plugin::CGIApp

by Ron Savage :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jaldhar

> > It'd be easier to find if we knew its name...
> >
>
> Module::Starter::Plugin::CGIApp
>
> as in the subject :-)

How sneaky is that!?

In this doc:
http://search.cpan.org/~jaldhar/Module-Starter-Plugin-CGIApp-0.01/lib/Module/Starter/Plugin/CGIApp.pm
I was confused by $data_item. What is it? I did search some other
modules you refer to, but didn't find any explanation.
--
Ron Savage
ron@...
http://savage.net.au/index.html



#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: RFC: Module::Starter::Plugin::CGIApp

by Jaldhar H. Vyas-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 24 Mar 2008, Ron Savage wrote:

>
> In this doc:
> http://search.cpan.org/~jaldhar/Module-Starter-Plugin-CGIApp-0.01/lib/Module/Starter/Plugin/CGIApp.pm
> I was confused by $data_item. What is it? I did search some other
> modules you refer to, but didn't find any explanation.

I was wondering if I had I had explained that properly.  Basically the
problem is that HTML::Template wants lists of hashes for tmpl_loops.  So
if you have  $data = ['a', 'b', 'c'];  it would get converted to

$data = [
    { data_item => 'a' },
    { data_item => 'b' },
    { data_item => 'c' },
];

so that in the template you could say

<tmpl_loop data>
     <tmpl_var data_item>
</tmpl_loop>

In retrospect I should have used foo or something instead of data to
indicate it is just an example.

--
Jaldhar H. Vyas <jaldhar@...>

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: RFC: Module::Starter::Plugin::CGIApp

by Ricardo SIGNES-12 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* "Jaldhar H. Vyas" <jaldhar@...> [2008-03-23T10:26:31]
> I've been playing with Module::Starter recently and I wrote a plugin which
> creates a basic CGI::Application based module.  It should be wending its
> way to CPAN as we speak.

Cool.  Is there a reason it had to be a plugin and not just a set of templates?
Were it just a ModuleStore set of templates, it could be made easier to pick
what templates to use when creating a new dist...

But cool!

--
rjbs

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: RFC: Module::Starter::Plugin::CGIApp

by Jaldhar H. Vyas-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 24 Mar 2008, Ricardo SIGNES wrote:

>
> Cool.  Is there a reason it had to be a plugin and not just a set of templates?
> Were it just a ModuleStore set of templates, it could be made easier to pick
> what templates to use when creating a new dist...
>

Module::Starter is not as extensible as it could be.  I filed one bug
about it already.  I was going to wait till I could offer some kind of
patch before filing more.  I would also like to see the ability to add
options to the module-starter command line application.

But it is possible I haven't fully understood how to go about extending so
if you have suggestions, I'd like to hear them.

--
Jaldhar H. Vyas <jaldhar@...>

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: RFC: Module::Starter::Plugin::CGIApp

by Ricardo SIGNES-12 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* "Jaldhar H. Vyas" <jaldhar@...> [2008-03-25T14:28:20]
> Module::Starter is not as extensible as it could be.

So true! :(

> I filed one bug about it already.  I was going to wait till I could offer
> some kind of patch before filing more.  I would also like to see the ability
> to add options to the module-starter command line application.

I'd like for module-starter to use App::Cmd.  I don't have many tuits lately,
though.

> But it is possible I haven't fully understood how to go about extending so
> if you have suggestions, I'd like to hear them.

For simple things like "make a dist with different templates" the only thing
that needs to change should be the template store.  You want to say, "Instead
of using my normal templates, use the ones HERE."

Making that possible should be easy, probably with --opt templates=STORE or
something being added.

--
rjbs

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


catalyst.pl for CGI::App? Yes: Module::Starter::Plugin::CGIApp

by Mark Stosberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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.

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@...

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,

- The plugins shouldn't have to be named.

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.

In summary, this should be possible:

cgi-app.pl MyApp

It would also be nice if Module::Starter prompted the user for the
author in the e-mail if they aren't present, rather than just exiting
with an error. ( I realize that's not a deficiency of this plugin. )

     Mark







#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: catalyst.pl for CGI::App? Yes: Module::Starter::Plugin::CGIApp

by Mark Stosberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 2008-06-18 at 14:12 -0500, 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.
>
> 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@...
>
> 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,
>
> - The plugins shouldn't have to be named.
>
> 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.
>
> In summary, this should be possible:
>
> cgi-app.pl MyApp
>
> It would also be nice if Module::Starter prompted the user for the
> author in the e-mail if they aren't present, rather than just exiting
> with an error. ( I realize that's not a deficiency of this plugin. )

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.

    Mark



#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: Re: catalyst.pl for CGI::App? Yes: Module::Starter::Plugin::CGIApp

by Ron Savage :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Mark

> > 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.

I've finished developing CGI::Application::Rose::Bouquet, which depends
on my Rose::DBx::Bouquet. I'm documenting them now, apart from $work of
course, and monsterous family issues (the latter now temporarily
solved).

The input is a module, i.e. Local::Wine features in the docs, and it can
be downloaded from my web site. The other 2 will be on CPAN.

The output is a fully-formed CGI::App-based set of modules implementing
a seach engine per db table, but no CRUD yet. I will be shipping a FCGID
app too.

All generated code uses HTML::Template-style templates.

Rose::DBx::Garden can be used instead of Rose::DBx::Bouquet, with some
small changes in the templates.

Just hold your breath.
--
Ron Savage
ron@...
http://savage.net.au/index.html



#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: catalyst.pl for CGI::App? Yes: Module::Starter::Plugin::CGIApp

by Jaldhar H. Vyas-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
>

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@...

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@...>

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


PATCH: bin/cgiapp-starter for Module::Starter::Plugin::CGIApp

by Mark Stosberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Jaldhar,

Attached is a patch for you.  It is bin/cgiapp-starter for the
distribution. It simplifies getting started in a number of the ways I
suggested, and provides user-centric script documentation, in addition
to the developer-centric module documentation.

Separately, I recommend removing "cvsignore" from the template/
directory. It looks an endorsement of CVS by the CGI::App community, and
I'd personally prefer not to have the association. Instead, I would ship
no SCM-related files at all.

   Mark


#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: PATCH: bin/cgiapp-starter for Module::Starter::Plugin::CGIApp

by Mark Stosberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 2008-06-19 at 22:43 -0400, Mark Stosberg wrote:
> Jaldhar,
>
> Attached is a patch for you.  It is bin/cgiapp-starter for the
> distribution. It simplifies getting started in a number of the ways I
> suggested, and provides user-centric script documentation, in addition
> to the developer-centric module documentation.

If this is rolled into a new release soon, I'll do another little
CGI::Application release to update the documentation to mention it. I
also forgot to mention "CGI::Application::Plugin::ErrorPage" in the 4.10
release.

I was also very surprised to see that it seems we mention "MVC" nowhere
in the CGI::Application POD!

That would likely get us a few more search hits if we included it.

 Mark



#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: PATCH: bin/cgiapp-starter for Module::Starter::Plugin::CGIApp

by Jaldhar H. Vyas-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 19 Jun 2008, Mark Stosberg wrote:

>
> Jaldhar,
>
> Attached is a patch for you.

The patch doesn't seem to have made it to the list.

>
> Separately, I recommend removing "cvsignore" from the template/
> directory. It looks an endorsement of CVS by the CGI::App community, and
> I'd personally prefer not to have the association. Instead, I would ship
> no SCM-related files at all.

ok.  I had svnignore too because it is personally useful to me but I'll
just write about how to set it up instead.

--
Jaldhar H. Vyas <jaldhar@...>

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: PATCH: bin/cgiapp-starter for Module::Starter::Plugin::CGIApp

by Mark Stosberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> The patch doesn't seem to have made it to the list.

Here's a second try.

   Mark



#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################