user7183174
user7183174

Reputation: 25

perl parsing cgi parameters

I remember reading somewhere that it's possible to pass arguments to a perl cgi script as such: www.example.org/cgiscript/arg1/arg2/arg3

I don't remember where I read it and searching didn't help me, so can anybody tell me if this actually works and if yes, how? Is this a mod_perl thing?

Upvotes: 1

Views: 365

Answers (1)

user149341
user149341

Reputation:

Yes. If a CGI script is called from a URL of the form:

http://example.com/path/to/script.cgi/foo/bar

then the path /foo/bar will be available in the environment variable PATH_INFO.

If you're using CGI.pm, this is also available in $q->path_info. If you're using mod_perl, Apache2::RequestRec has the same method.

Upvotes: 4

Related Questions