Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
$filename1 is a unix filesystem path, which is the way that the file *really* is addressed.

$filename2 is a web address. The web server translates the web address into a unix filesystem filename, based on how you have the web server configured. http://my_site/ is the web address of the web server, the next part, /cgi-bin/, is probably your cgi root, which is set up in your web server configuration, and translates to some absolute base path, in your case it appears to be /var/apache/cgi-bin/. The rest, user/test.txt refers to a specific file on that server.

So the web server filename translation changes your address to /var/apache/cgi-bin/user/test.txt, which is exactly what $filename1 is.

So, after all that, the web server automatically does that translation, but perl assumes that you are giving a relative or absolute pathname that is of the form your operating system normally deals with, i.e. it doesnt do the translation that the web server does. If you're much into unix, think about why a command like rm $filename2 wont work right. perl assumes filenames just like the unix shell does.

The reasons for the web address translation are many, it allows virtual hosting, and it also keeps me from doing something like http://your_server/etc/passwd - which you probably dont want me doing.

You should probably read up on apache & web server conifguration in general.


In reply to Re^2: file open problem with scheduled jobs by shemp
in thread file open problem with scheduled jobs by nmete

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-04-23 19:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found