Hi Suthakar --

> I am appending the web input to a txt file , but i need to 
> increment the
> number 1,2 etc.. in the txt file based on each input which i receive
> from the web.Can you suggest something for this.


Assuming you don't have access to a relational database (which would obviate
the need for the text file), to maintain a "serial number" you will need to
maintain the "state" of your counter somewhere on the web server.

In your case, this is probably going to mean maintaining a second text file
to which the web server have write access.  This file should contain the
highest number used.  Whenever you have to write an entry to your text file,
use this "state file" to get the next highest number, then update the state
file with the new high number.

A critical thing to remember is that you have to LOCK this file, lest
another user session simultaneously write to this file.  Locking will cause
any concurrent request to wait ("block" is the technical term) until the
first process is done.  There are many Perl modules which support locking.
Search CPAN for one which suits your tastes.


TTYL,

-Jesse-



  Jesse Erlbaum, CTO
  Vanguard Media
  http://www.vm.com
  212.242.5317 x115
  [EMAIL PROTECTED]



---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/cgiapp@lists.vm.com/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to