¡Hola dancers,

Like everyone else, I have been enjoying making apps per the following pattern

        get '/foo' => sub {
                my $foo1 = param 'foo1' || die 'need foo1';
                my $foo2 = param 'foo2' || $default_foo2;
                ..
        };

        get '/bar' => sub {
                my $bar1 = param 'bar1' || die 'need bar1';
                my $bar2 = param 'bar2' || $default_bar2;
                ..
        };

For a number of reasons (see below), I am wondering if I could somehow generate 
these routes from a catalog of requisite information (resource, parameters, 
defaults, required or optional, and so on) held in some form of data source, 
most likely a database. Any ideas on how I could implement such a capability 
would be much appreciated. I will personally drink a beer toasting all ideas.

I need a catalog of all these routes for several reasons --

1. I have repurposed the Dancer::Plugin::SiteMap to endow all my apps with 
certain meta routes, one of which actually lists all the available routes (I 
call them resources, in keeping with the REST-compliant terminology). It works, 
but is kludgey.

2. I want to implement a uniform parameter validation and error/usage 
generation message.

3. I want to create a capability so new users can register their resources with 
my application and make them available to others.

A central catalog of all the resources (this is a big, data 
integration/analysis/dissemination initiative) will make any of the above and 
perhaps many other needs easy to fulfill.

I look forward to your as-usual-innovative suggestions.


--
Puneet Kishor
_______________________________________________
Dancer-users mailing list
[email protected]
http://www.backup-manager.org/cgi-bin/listinfo/dancer-users

Reply via email to