Suppose you have a perl program that is called by a web page to
generate another web page. The program is written to load data from a
text file on the server and make certain substitutions in the loaded
text prior to the output of html.
If one user is on the site, it should not be a problem. If many users
try to access it nearly simultaneously, will it be a problem?
example:
file: text.txt
I am <adjective>.
file: process.perl
....
open INPUT, "./text".".txt";
@list = <INPUT>;
close INPUT;
foreach(@list)
{
s/<adjective>/stupid/g;
}
....
What happens here when a second user causes the program to run when
the first user is at the point where the text file is opened and not
yet closed? 4 2448
>Suppose you have a perl program that is called by a web page to generate another web page. The program is written to load data from a text file on the server and make certain substitutions in the loaded text prior to the output of html.
If one user is on the site, it should not be a problem. If many users try to access it nearly simultaneously, will it be a problem?
That's what file locking is designed for.. look into flock()..
Regards,
Chris
P.S. You do realise this a PHP group ?
On 21 Aug 2004 22:33:08 -0700, ma**@affordablemedicalsoftware.com (MJL) wrote: Suppose you have a perl program that is called by a web page to generate another web page.
Suppose you post this Perl program to a PHP newsgroup... what is the expected
result? :-) Try comp.lang.perl.misc.
The program is written to load data from a text file on the server and make certain substitutions in the loaded text prior to the output of html.
If one user is on the site, it should not be a problem. If many users try to access it nearly simultaneously, will it be a problem?
Not if it's read-only. If it's updated, then yes, you'll have multiple
processes stomping on each other's data, in which case you need to put locking
around it, or better, use a database, as concurrent access is one of the
several main reasons you'd use a database over a flat file.
example:
open INPUT, "./text".".txt";
You probably want to be specifying a filemode here - assuming you just want
'r' (read-only).
What happens here when a second user causes the program to run when the first user is at the point where the text file is opened and not yet closed?
Presumably operating-system dependent, but it would have to be a pretty duff
operating system to disallow read-only access to multiple processes.
--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
> Regards, Chris
P.S. You do realise this a PHP group ?
Oh, man. I am so embarrassed. Sorry. I have been so entangled in
playing with code in the two languages this weekend that I really
screwed up and posted to the wrong group. My perl script is
generating HTML and PHP. Sorry again.
"MJL" wrote: Suppose you have a perl program that is called by a web page to generate another web page. The program is written to load data
from a text file on the server and make certain substitutions in the
loaded text prior to the output of html.
If one user is on the site, it should not be a problem. If many
users try to access it nearly simultaneously, will it be a problem?
example:
file: text.txt
I am <adjective>.
file: process.perl
.... open INPUT, "./text".".txt"; @list = <INPUT>; close INPUT; foreach(@list) { s/<adjective>/stupid/g; } ....
What happens here when a second user causes the program to run when the first user is at the point where the text file is opened and
not yet closed?
This is a php newsgroup. Try a perl newsgroup for better coverage.
-- http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-scalabil...ict142045.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=475202 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Xah Lee |
last post by:
# -*- coding: utf-8 -*-
# Python
# to open a file and write to file
# do
f=open('xfile.txt','w')
# this creates a file "object" and name it f.
# the second argument of open can be
|
by: Kirt Loki Dankmyer |
last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile
it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of
different switches, but I can't get it to compile....
|
by: pc |
last post by:
hi all,
I have been blessed with the task of writing a web based database
representing the state of our globally installed isam databases.
there are basically four steps in setting this up:
...
|
by: Alex |
last post by:
I'm not exactly sure how to use these two languages together. It seems
to me that they both totally different things.
PERL = databases, heavy processing, server functions. But I can also
write...
|
by: 8anos |
last post by:
Hello,
I am new at the community and newbie at programming :)
As you may know rapidshare provides a perl script for linux, to upload files at their servers.
You can find the original scripts at...
| |
by: KevinADC |
last post by:
Note: You may skip to the end of the article if all you want is the perl code.
Introduction
Uploading files from a local computer to a remote web server has many useful purposes, the most...
|
by: KevinADC |
last post by:
Note: You may skip to the end of the article if all you want is the perl code.
Introduction
Many websites have a form or a link you can use to download a file. You click a form button or click...
|
by: AmberJain |
last post by:
Windows Autorun FAQs: Programs dealing with autoruns
Linked from the Original article- "Windows Autorun FAQs: Description".
Que: Can you list programs that help me to view/modify the autoruns...
|
by: sbettadpur |
last post by:
hello,
I am trying to install the Text::NLP::Stanford::EntityExtract perl module on windows xp. But its not installing properly... can anybody tell solution for the above problem.
But its...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |