简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM