<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1013241" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1013241</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/printing-problems#comment-1076787</link>
    <description> &lt;p&gt;Oh, and a good habit to get into is to be explicit about the file read/write request.&lt;/p&gt;
&lt;p&gt;Use either &#039;&amp;lt;$file&#039; to read, &#039;&amp;gt;$file&#039; to write and &#039;&amp;gt;&amp;gt;$file&#039; to append. Using &#039;$file&#039; on it&#039;s own can lead to exploitation of the file while the data is being processed.&lt;/p&gt;
&lt;p&gt;I got my ass burned at comp.lang.perl.misc for just using open FH, $File;&lt;/p&gt;
 </description>
     <pubDate>Tue, 16 Jan 2001 11:42:07 +0000</pubDate>
 <dc:creator>Matt@Ikonboard</dc:creator>
 <guid isPermaLink="false">comment 1076787 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/printing-problems#comment-1076786</link>
    <description> &lt;p&gt;Hi Rob, thanks for the welcome &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;Quote: Just curious, is there a reason to flock the file when reading content? I always thought that flock was only required when writing to a file?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I always lock to read and write out of habit. A file lock is conditional, so if it&#039;s locked to write (flock FH, 2 or better flock FH, LOCK_EX) and a non-locked request to read is made, the write lock is dropped and the data *can* be flushed before it&#039;s printed back.&lt;/p&gt;
&lt;p&gt;I learnt that the hard way. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Tue, 16 Jan 2001 11:38:23 +0000</pubDate>
 <dc:creator>Matt@Ikonboard</dc:creator>
 <guid isPermaLink="false">comment 1076786 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/printing-problems#comment-1076781</link>
    <description> &lt;p&gt;Matt, sorry for not mentioning it before, but welcome to TWF, and thanks for your contributions so far!&lt;/p&gt;
&lt;p&gt;Just a simple thing with your code, if he was planning on printing any output to the browser, he will need:&lt;/p&gt;
&lt;p&gt;print &quot;Content-type:text/html\n\n&quot;;&lt;br /&gt;
.&lt;/p&gt;
&lt;p&gt;Here is my simple solution&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;#!/usr/bin/perl -w&lt;br /&gt;my $file = &amp;#039;filename.html&amp;#039;;&lt;br /&gt;print &amp;quot;Content-type:text/html\n\n&amp;quot;;&lt;br /&gt;open(IN,$file) or die &amp;quot;Cannot open $file: $!&amp;quot;;&lt;br /&gt;print while &amp;lt;IN&amp;gt;;&lt;br /&gt;close(IN);&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;Just curious, is there a reason to flock the file when reading content?  I always thought that flock was only required when writing to a file?&lt;/p&gt;
 </description>
     <pubDate>Tue, 16 Jan 2001 03:39:01 +0000</pubDate>
 <dc:creator>Rob Pengelly</dc:creator>
 <guid isPermaLink="false">comment 1076781 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/printing-problems#comment-1076779</link>
    <description> &lt;p&gt;How long is a piece of string?&lt;/p&gt;
&lt;p&gt;Can you refine the question somewhat? If you want to take a HTML page, and include it for output in your script, then something like:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;open FH, &amp;#039;&amp;lt;/path/to/file.html&amp;#039; or die $!;&lt;br /&gt;flock FH, 1 or die $!;&lt;br /&gt;while (&amp;lt;FH&amp;gt;) { print $_ }&lt;br /&gt;close FH;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;Would do it.&lt;/p&gt;
 </description>
     <pubDate>Tue, 16 Jan 2001 03:01:01 +0000</pubDate>
 <dc:creator>Matt@Ikonboard</dc:creator>
 <guid isPermaLink="false">comment 1076779 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
