On 2005-07-11, David Emery <suppressed> wrote:
> Hi all,
>
> With many cool CAP Plugins being produced recently, and all the REST
> discussion, I decided to try my hand at writing a Plugin of my
> own. It's embarrassingly simple, but maybe someone will find it
> useful.
David,
Thanks for the contribution. Here's some feedback on the POD.
> use CGI::Application::Plugin::PathInfo
Add a trailing semicolon there. And doesn't the user need to import
path_info_to_query() here? The docs below says it's next exported.
> # In setup()
> sub setup {
> my $self = shift;
> $self->start_mode('list');
> $self->run_modes(
> 'edit' => 'showform',
> 'list' => 'showlist',
> 'products' => 'showdetail'
> );
>
> # set param names for the elements of path info
> $self->param('path_info_vars'=>
> {
> 'showdetail'=>['rm','category_id','item_id','color'],
> 'showform'=>['rm','item_id'],
> 'showlist'=>0, #ignore any path info (besides runmode)
> }
> );
> }
It would make more sense to me to have the path_info_vars be run mode
names, not subroutine names, especially since run modes can point to
anonymous subs.
Also, it would be nice if the 'showlist => 0' could simply be excluded
above, if no special action is needed.
> # This URL:
> # http://www.myapp.com/products/jam/1999/purple
> #
> # would result in the following params added to $self->query
>
> 'rm' => 'products',
> 'category' =>'jam',
> 'item_id' =>'1999',
> 'color' =>'purple'
This example could be clearer if it there was CGI script present in the
URL, instead of an implied index.cgi.
Finally, it could help the module name to include detail about what it
does with PATH_INFO, since there is already some PATH_INFO processing
built into CGI::App.
Maybe ::PathInfo2Param or PathInfoToQuery, to match your method name.
Overall, I like the idea. This style of URL is more user-friendly, and
has traditionally been more work for the developer to parse.
Mark
--
. . . . . . . . . . . . . . . . . . . . . . . . . . .
Mark Stosberg Principal Developer
suppressed Summersault, LLC
765-939-9301 ext 202 database driven websites
. . . . . http://www.summersault.com/ . . . . . . . .
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.