<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1012894" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1012894</link>
    <description></description>
    <language>en</language>
          <item>
    <title>Error logs</title>
    <link>https://www.webmaster-forums.net/serverside-scripting/add-counter-form#comment-1074778</link>
    <description> &lt;p&gt;I&#039;m sorry, there were syntax errors is the code I provided.  I should have tried running it before pawning it off as working code.&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;use Fcntl qw( O_RDWR O_CREAT LOCK_EX );&lt;br /&gt;&lt;br /&gt;$counter = &amp;quot;counter.txt&amp;quot;;&lt;br /&gt;&lt;br /&gt;sysopen COUNTER, $counter, O_RDWR|O_CREAT or die &amp;quot;can&amp;#039;t read/write $counter: $!$&lt;br /&gt;flock COUNTER, LOCK_EX or die &amp;quot;can&amp;#039;t flock: $!&amp;quot;;&lt;br /&gt;chomp (my $n = &amp;lt;COUNTER&amp;gt; || 0);&lt;br /&gt;seek COUNTER, 0, 0 or die &amp;quot;can&amp;#039;t rewind: $!&amp;quot;;&lt;br /&gt;print COUNTER ++$n or die &amp;quot;can&amp;#039;t print: $!&amp;quot;;&lt;br /&gt;truncate COUNTER, tell COUNTER or die &amp;quot;can&amp;#039;t truncate: $!&amp;quot;;&lt;br /&gt;close COUNTER or die &amp;quot;can&amp;#039;t close: $!&amp;quot;;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;This code works for me.  And you might want to include the CGI::Carp module in your program, so that if this &lt;strong&gt;die()&lt;/strong&gt;s, you&#039;ll be alerted:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;use CGI::Carp &amp;#039;fatalsToBrowser&amp;#039;;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
 </description>
     <pubDate>Wed, 29 Nov 2000 16:32:36 +0000</pubDate>
 <dc:creator>japhy</dc:creator>
 <guid isPermaLink="false">comment 1074778 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/add-counter-form#comment-1074776</link>
    <description> &lt;p&gt;Tks japhy &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;br /&gt;
but I just added that code to the script and an error ocurred.&lt;/p&gt;
&lt;p&gt;This is the script I am using&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.cgi.tj/scripts/alienform/af.txt&quot; class=&quot;bb-url&quot;&gt;http://www.cgi.tj/scripts/alienform/af.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks again,&lt;/p&gt;
 </description>
     <pubDate>Wed, 29 Nov 2000 16:20:05 +0000</pubDate>
 <dc:creator>Nico</dc:creator>
 <guid isPermaLink="false">comment 1074776 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Form fields are overrated</title>
    <link>https://www.webmaster-forums.net/serverside-scripting/add-counter-form#comment-1074775</link>
    <description> &lt;p&gt;There&#039;s no need to use the form to do it, just modify the program to increment a counter file every time the program is accessed (successfully, mind you -- do this after any error checking you need done).&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;use POSIX qw( O_RDWR O_CREAT LOCK_EX );&lt;br /&gt;&lt;br /&gt;$counter = &amp;quot;/path/to/counter.txt&amp;quot;;&lt;br /&gt;&lt;br /&gt;sysopen COUNTER, $counter, O_RDWR|O_CREAT or die &amp;quot;can&amp;#039;t read/write $counter: $!&amp;quot;;&lt;br /&gt;flock COUNTER, LOCK_EX or die &amp;quot;can&amp;#039;t flock: $!&amp;quot;;&lt;br /&gt;chomp (my $n = &amp;lt;COUNTER&amp;gt; || 0);&lt;br /&gt;seek COUNTER, 0, 0 or die &amp;quot;can&amp;#039;t rewind: $!&amp;quot;;&lt;br /&gt;print COUNTER ++$n or die &amp;quot;can&amp;#039;t print: $!&amp;quot;;&lt;br /&gt;truncate COUNTER or die &amp;quot;can&amp;#039;t truncate: $!&amp;quot;;&lt;br /&gt;close COUNTER or die &amp;quot;can&amp;#039;t close: $!&amp;quot;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
 </description>
     <pubDate>Wed, 29 Nov 2000 14:56:29 +0000</pubDate>
 <dc:creator>japhy</dc:creator>
 <guid isPermaLink="false">comment 1074775 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
