request uri in CGI module

M

Moritz Karbach

Hi everyone,

I need something similar to the PHP variable $SERVER[REQUEST_URI], that is
the full string someone entered in his browser, the url and the query.

Is there some easy way to get this? Or do I have to compose it again using
CGI::params and lots of ? and & parsing?

Cheers,

- Moritz
 
A

A. Sinan Unur

I need something similar to the PHP variable $SERVER[REQUEST_URI],
that is the full string someone entered in his browser, the url and
the query.

I am not fmailiar with PHP to know exactly what that variable contains.
Is there some easy way to get this? Or do I have to compose it again
using CGI::params and lots of ? and & parsing?

Why not read the documentation?

http://search.cpan.org/~lds/CGI.pm-3.08/CGI.pm#CREATING_A_SELF-
REFERENCING_URL_THAT_PRESERVES_STATE_INFORMATION:

or

http://search.cpan.org/~lds/CGI.pm-
3.08/CGI.pm#OBTAINING_THE_SCRIPT'S_URL

Sinan
 
M

Moritz Karbach

A. Sinan Unur said:
Why not read the documentation?

Actually I had a quick look at the docu and I searched it for "request uri"
and something similar, but I didn't find anything. Obviosly I should have
had a closer look, what you found was exactly what I needed.

Thanks!

- Moritz
 
G

Gunnar Hjalmarsson

Moritz said:
I need something similar to the PHP variable $SERVER[REQUEST_URI], that is
the full string someone entered in his browser, the url and the query.

Is there some easy way to get this?

Yes. In Perl, the environment variables are available in the %ENV hash,
so $ENV{REQUEST_URI} is probably what you want.

To print the whole %ENV hash you can do:

print "$_ = $ENV{$_}\n" for keys %ENV;

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,169
Messages
2,570,920
Members
47,464
Latest member
Bobbylenly

Latest Threads

Top