[prev in list] [next in list] [prev in thread] [next in thread]
List: apache-modperl
Subject: Re: path recognition question
From: Mithun Bhattacharya <mithnb () gmail ! com>
Date: 2022-05-16 17:41:38
Message-ID: CAHTPV9+UtRQW1P5tcNL0B7p0U1av0Pa6Pee45r4tag+1b1TGYg () mail ! gmail ! com
[Download RAW message or body]
You still have $r->path just pull the id from it ?
On Thu, May 5, 2022, 4:20 PM Michael A. Capone <mcapone@cablewholesale.com>
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 <henrik@tomatoservers.com>
> 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:*
> *john@lariat.co <john@lariat.co>*
>
> * Customer Service:*
> 877.268.6667
> support@lariat.co
>
>
>
[Attachment #3 (text/html)]
<div dir="auto"><div>You still have $r->path just pull the id from it \
?<br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 5, \
2022, 4:20 PM Michael A. Capone <<a \
href="mailto:mcapone@cablewholesale.com">mcapone@cablewholesale.com</a>> \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<tt>(Sorry for the late reply, been out of town)<br>
<br>
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?<br>
<br>
if the url is <a href="http://www.example.com/app/user/12345" target="_blank" \
rel="noreferrer">www.example.com/app/user/12345</a>, 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.<br>
<br>
Note that you'd have to have PerlSetupEnv on (the default,
although I think many may turn it off).<br>
<br>
Or am I completely missing something?<br>
<br>
Michael<br>
</tt><br>
<div>On 4/21/22 6:40 AM, John Dunlap wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">I ended up writing something custom to do that.<br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, Apr 20, 2022 at 11:22
PM Henrik S <<a href="mailto:henrik@tomatoservers.com" target="_blank" \
rel="noreferrer">henrik@tomatoservers.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">given the sample \
url:<br> <br>
/api/user/id<br>
<br>
the part of "/api/user" is fixed. and there is a handler
setup for this <br>
path.<br>
<br>
how to get the id part in mod_perl?<br>
<br>
in other framework I could get it with the similar format:<br>
<br>
/api/user/:id<br>
<br>
puts "hallo #{id}"<br>
<br>
<br>
Thank you.<br>
</blockquote>
</div>
<br clear="all">
<br>
-- <br>
<div dir="ltr">
<div dir="ltr">
<div style="font-size:small;font-family:arial"><span>John Dunlap</span><br>
</div>
<div style="font-size:small;font-family:arial"><i \
style="font-family:"trebuchet ms",sans-serif"><span \
style="color:rgb(153,153,153);font-family:tahoma,sans-serif;font-style:normal">CTO | \
</span><span style="font-family:tahoma,sans-serif;font-style:normal"><font \
color="#ff9900">Lariat</font></span><span \
style="color:rgb(153,153,153);font-family:tahoma,sans-serif;font-style:normal"> \
</span></i><br> </div>
<div style="font-size:small;font-family:arial"><i \
style="font-family:"trebuchet ms",sans-serif"><span \
style="color:rgb(153,153,153);font-family:tahoma,sans-serif;font-style:normal"><br> \
</span></i></div> <div style="font-size:small;font-family:arial"><i \
style="font-family:"trebuchet ms",sans-serif"><span \
style="color:rgb(153,153,153);font-family:tahoma,sans-serif;font-style:normal"><b>Direct:</b></span></i></div>
<div style="font-size:small;font-family:arial"><i \
style="font-family:"trebuchet ms",sans-serif"><span \
style="color:rgb(153,153,153);font-family:tahoma,sans-serif;font-style:normal"><a \
href="mailto:john@lariat.co" style="color:rgb(17,85,204)" target="_blank" \
rel="noreferrer">john@lariat.co</a></span></i></div> <div \
style="font-size:small;font-family:arial"><i style="font-family:"trebuchet \
ms",sans-serif"><span \
style="color:rgb(153,153,153);font-family:tahoma,sans-serif;font-style:normal"><br> \
<b>Customer Service:</b></span></i></div> <div \
style="font-size:small;font-family:arial"><span \
style="color:rgb(153,153,153);font-family:arial,helvetica,sans-serif"><a \
value="+18772686667" style="color:rgb(17,85,204)" \
rel="noreferrer">877.268.6667</a></span></div> <div \
style="font-size:small;font-family:arial"><span \
style="color:rgb(153,153,153);font-family:arial,helvetica,sans-serif"><a \
href="mailto:support@lariat.co" style="color:rgb(17,85,204)" target="_blank" \
rel="noreferrer">support@lariat.co</a></span></div>
<div style="font-size:small;font-family:arial"><img width="100" \
height="60"></div> </div>
</div>
</blockquote>
<br>
</div>
</blockquote></div></div></div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic