Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: could not open a physical file using href

by CountZero (Bishop)
on Sep 21, 2009 at 17:55 UTC ( [id://796587]=note: print w/replies, xml ) Need Help??


in reply to could not open a physical file using href

It is not because out of laziness or convenience a great many number of URLs bear a close resemblance to the file which is finally served by the web-server, that there is any necessary link between the URL and such file. As a matter of fact, your above CGI-script is most likely not called 'undersite/1.txt' or '1.txt', but rather 'something.pl' or 'something.cgi' or anything else you have your web-server configured to accept as the link to your script.

It has been suggested that perhaps you should use the file:// URL-scheme, but beware, this is likely to work only if the file is on the same computer the web-page is being viewed upon. RFC 1738 says as follows about this scheme:

3.10 FILES

The file URL scheme is used to designate files accessible on a particular host computer. This scheme, unlike most other URL schemes, does not designate a resource that is universally accessible over the Internet.

A file URL takes the form:

    file://<host>/<path>

where <host> is the fully qualified domain name of the system on which the <path> is accessible, and <path> is a hierarchical directory path of the form <directory>/<directory>/.../<name>.

For example, a VMS file

  DISK$USER:[MY.NOTES]NOTE123456.TXT

might become

  <URL:file://vms.host.edu/disk$user/my/notes/note12345.txt>

As a special case, <host> can be the string "localhost" or the empty string; this is interpreted as `the machine from which the URL is being interpreted'.

The file URL scheme is unusual in that it does not specify an Internet protocol or access method for such files; as such, its utility in network protocols between hosts is limited.

The very last sentence is of course the most important.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://796587]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-19 09:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found