Is this something which would interest anyone?

John Dunlap <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAC5eUStx3+j46t0W4goAneWeYPPFe7zuxnLKymdm-uJWGe4W9Q@mail.gmail.com>
I've been working in mod_perl for almost a year now and something which I
struggled with, at first, was request routing. The application that I
maintain uses a simple hash lookup using $r->uri as the key to the
package/method name which should be invoked to respond to the request. I
really disliked the inflexibility of this approach so I've since developed
a more flexible(recursive) lookup mechanism which allows me to use restful
uri's which include path parameters. For example, this code allows me to do
things like this,

my $registry = ServiceRegistry->new;
$registry->register('SERVICE1', '/api/rest/service1/{param1}/list');
my $service = $registry->find($r->uri); # $r->uri returns
'/api/rest/service1/5732/list'
print "$service\n"; # Prints "SERVICE1"
my $parameters = $registry->extract_parameters($r->uri); # $r->uri returns
'/api/rest/service1/5732/list'
print $parameters->{'param1'} . "\n"; # Prints 5732

In this example, I'm registering a scalar, for simplicity, but you can
register anything(array, hashes, objects, etc). It would take me a little
time to clean it up and package it in a way which would be useful to others
but, before I go to that trouble, I just wanted to ask if anyone would be
interested in my releasing this module on CPAN?

John
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.