Hi,

Just an idea, but it will not surprise me if it was the good one. The problem could be in using a relative path to get the file. The path is relative to the current working directory of the Apache process handling your request, and this will almost certainly be not what you think it is. Try replacying the relative path with the absolute one. Moreover, using relative paths is almost always a BadThing, exactly because you cannot know what would you get at runtime.

Using cat, while strictly possible, may not be advisable. The slurp solution proposed, eg.

open FOO,$path; print <FOO>

are better, but they ask for the interpreter to slurp the whole file before sending it. If the file is relatively small this is not a problem, and the above solution is good, even if this one

{ local $/; open FOO,$path; $text = readline FOO; close FOO; } print $text;

is better IMHO.

But if the file is big then:

print while (<FOO>);

will likely be a better idea.

Hoping it wil help.

Greetings


Leo TheHobbit

In reply to Re: LWP::UserAgent with development website by TheHobbit
in thread LWP::UserAgent with development website by patricia_e

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.