Re: [OT] Re: about request route ($r->path_info)

2017-08-08 Thread Randolf Richardson
Thank you for the correction and clarification (and subject line update) -- you provided some excellent and very helpful information. It's good to know that the AcceptPathInfo directive isn't needed for the Location stanza (simpler configurations are my preference after all), an

Re: about request route

2017-08-08 Thread 风河
Anyway I have tranformed this opensource project: https://github.com/skx/dns-api.org which is powered by dancer, to mod_perl. the API address: http://h.dnsbed.com/$type/$host which is entirely mod_perl backend. :) On Tue, Aug 8, 2017, at 09:45 AM, 风河 wrote: > Thanks for all helps. > > On M

[OT] Re: about request route ($r->path_info)

2017-08-08 Thread tomcat
Hi Randolf. I mark this OT because it is not directly related to the OP's initial question. But maybe a nitpick : The httpd documentation on AcceptPathInfo is certainly interesting to read (and in years of working with Apache httpd and mod_perl I have never seen it before), but I believe that y

Re: about request route

2017-08-07 Thread 风河
Thanks for all helps. On Mon, Aug 7, 2017, at 08:26 PM, André Warnier (tomcat) wrote: > On 07.08.2017 13:18, 风河 wrote: > > Hi, > > > > for this like request: > > curlhttp://dns-api.org//dns-api.org > > > > in Dancer we could write: > > > > get '/:type/:domain/?' => sub { > > > > my $rtype

Re: about request route ($r->path_info)

2017-08-07 Thread Randolf Richardson
In your "httpd.conf" file (for your VirtualHost if you're using virtual hosts) you'll need to add this line: AcceptPathInfoOn Then you may find the documentation surrounding $r->path_info to be of particular interest, which you can read about here:

Re: about request route

2017-08-07 Thread John Dunlap
This is what I do in our application, using a module that we created in-house: 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"; # Pri

Re: about request route

2017-08-07 Thread Mithun Bhattacharya
Another way to look at this is Apache has hooks for the location - that is the URI you are requesting. Apache doesn't care whether you do a GET or a POST/PUT to it and it is left to the underlying subsytems to manage it - which is your case would be mod_perl. You can easily have the handler do a if

Re: about request route

2017-08-07 Thread tomcat
On 07.08.2017 13:18, 风河 wrote: Hi, for this like request: curlhttp://dns-api.org//dns-api.org in Dancer we could write: get '/:type/:domain/?' => sub { my $rtype = params->{ 'type' }; my $domain = params->{ 'domain' }; But in a MP handler, how could we get the similiar result

Re: about request route

2017-08-07 Thread Lathan Bidwell
Hello, MP does not by default include a routing engine like Dancer or Mojo or other frameworks. There are routing engines available (but I'm not very familair with them). For a pure MP option, see this example from something I've done: $base_uri = "/app/" uri = /app/type//domain/dns-api.org