First of all, you didn't say so, but it sounds like you're writing a CGI program, right?

Why would I be getting the error with the absolute? What incredibly elementary thing am I missing?

You sound like you're confusing URLs with UNIX file paths. An "absolute" URL identifies the service and the host, such as "http://www.perlmonks.com". A relative url references another web page, relative to the current web page.

An absolute UNIX filename specifies the exact location of the file: the list of subdirectories you must go through to find the file, starting from the root directory. Absolute unix pathnames start with a "/", such as "/etc/passwd".

When writing CGI scripts, you often deal with both: you write to UNIX files, and you print out links to web pages for browers to follow.

The reason the first example works is because UNIX pathnames, as well as URLs, both share the same way of writing "one level up": by writing a ".." in front of the path to follow.

The reasons the second doesn't is because you're not asking for an absolute UNIX pathname (which is what perl deals with), you're asking for an odd looking relative pathname. Specificly, you've told Perl something like: "from the current directory (because there's no '/' at the start", go to directory "http:", then to the directory "www.domain.com", then to the directory "WysiwygPro", and then create the file "content.txt".

The directories "http:", and "www.domain.com" probably don't exist. If you really want to use the full pathname of the UNIX directory your web server is using, you'll have to look it up: but I don't know why you'ld want it.

Both relative links and relative pathnames are often prefered in both cgi scripts and in HTML, because you can move the cgi script and files without changing all the absolute references.

Hope this helps clear up some of the confusion.

--
AC


In reply to Re: Write file using full path returns error by Anonymous Monk
in thread Write file using full path returns error by bradcathey

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.