Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is the path to my Web directory?

directory path web
0
Posted

What is the path to my Web directory?

0

The wwwhome command returns the full path to your Web directory and can be used within CGI programs to refer to the location of your Web directory. The need to do so often arises when a CGI program must read or write to other files in your Web directory. Two examples follow, each demonstrating how the wwwhome command might be leveraged within a CGI program written in Perl. This first example uses wwwhome to determine the location of a data file: #!/usr/local/bin/perl chop($wwwhome = `wwwhome`); open(DATA,”$wwwhome/data.txt”); … The next example uses wwwhome to add a new directory to the location where Perl libraries are found: #!/usr/local/bin/perl BEGIN { chop($wwwhome = `wwwhome`); } use lib “$wwwhome/mypackage”; use MyPackage; … Note: You can hard code the location of your Web directory into a CGI program, but you run the risk of it breaking if your Web directory ever moves.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123