Current location: Hot Scripts Forums » Programming Languages » Perl » getting the path to cgi-bin


getting the path to cgi-bin

Reply
  #1 (permalink)  
Old 08-18-05, 10:37 AM
abtimoteo abtimoteo is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Question getting the path to cgi-bin

how do you turn the path to cgi-bin into a variable? i know that, with access to the shell, you can get the path using the linux command pwd. thereafter, the path can be stored in a scalar variable. what i would like to know is if perl has a built-in variable that contains the path or a function or module that can spit out the same? thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 09-04-05, 01:25 AM
Chas Chas is offline
Coding Addict
 
Join Date: Oct 2003
Location: California
Posts: 359
Thanks: 0
Thanked 0 Times in 0 Posts
There is really nothing built-in that will give you this. You can use the $0 special variable[1] to get the script name and deduce it from that assuming that you are running the script from the cgi-bin. You can also grab the $ENV{DOCUMENT_ROOT} value and tack on a '/cgi-bin'. The problem with that is the cgi-bin is not always under the doc root.

~Charlie

[1] http://perldoc.perl.org/perlvar.html#$0
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Idiot's Guide to Perl and Web CGI liljoeyjordison Perl 1 06-24-05 02:27 PM
CGI Script Form to Email Help!!! EOM Perl 1 06-22-05 12:19 AM
Help - CGI Script Installation Problem. senaia Perl 1 05-21-05 11:20 PM
CGI or PHP better? mhs12grade1992 PHP 11 02-10-05 08:01 PM
Loading XS Code from CGI - Not Possible?? aret Perl 1 12-21-04 01:33 AM


All times are GMT -5. The time now is 04:04 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.