Re: path recognition question
Mithun Bhattacharya <[email protected]> Mon, 16 May 2022 12:41:38 -0500
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <CAHTPV9+UtRQW1P5tcNL0B7p0U1av0Pa6Pee45r4tag+1b1TGYg@mail.gmail.com> |
You still have $r->path just pull the id from it ? On Thu, May 5, 2022, 4:20 PM Michael A. Capone <[email protected]> wrote: > (Sorry for the late reply, been out of town) > > Recognizing that I've never gone as indepth with mod_perl as other users, > but it seems to me that accessing "id" here would just be a matter of > grabbing the PATH_INFO environment variable, wouldn't it? > > if the url is www.example.com/app/user/12345, then the program is > /app/user, and $ENV{'PATH_INFO'} would contain /12345. Chop off the > leading forward slash and you've got your ID. > > Note that you'd have to have PerlSetupEnv on (the default, although I > think many may turn it off). > > Or am I completely missing something? > > Michael > > On 4/21/22 6:40 AM, John Dunlap wrote: > > I ended up writing something custom to do that. > > On Wed, Apr 20, 2022 at 11:22 PM Henrik S <[email protected]> > wrote: > >> given the sample url: >> >> /api/user/id >> >> the part of "/api/user" is fixed. and there is a handler setup for this >> path. >> >> how to get the id part in mod_perl? >> >> in other framework I could get it with the similar format: >> >> /api/user/:id >> >> puts "hallo #{id}" >> >> >> Thank you. >> > > > -- > John Dunlap > *CTO | Lariat * > > *Direct:* > *[email protected] <[email protected]>* > > * Customer Service:* > 877.268.6667 > [email protected] > > >