in reply to LWP::UserAgent with development website
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
|
---|