print p( {align=>'center'}, a( {href=>'/cgi-bin/vault.pl'}, img{src=>'/data/images/hellas.gif'} ));
Here Perl can find is own way to determine and opne the file, how come it doesnt need an absolute path here?
Perl never sees those uris (not paths) as anything but strings. Those uris are sent to the web browser as is, never checked or opened.
The web browser create absolute uris from those relative uris and the uri of the document in which they are found, parses the uris into their components, requests those uris (sending only the path portion of the the absolute uri). Apache converts the partial uris to disk paths with the help of DocumentRoot and serves the files.
How would i be able to specify the correct path since the paths would differ?
Well, you could put it in a directory relative to your script, or you could place a configuration file with the location of the file in a directory relative to the script.
In reply to Re^5: Cannot open a file using a relative path
by ikegami
in thread Cannot open a file using a relative path
by Nik
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |