|
Tutorial 1 - Server Side Counting
|
|
Perl:
|
|
Perl is reputed to be the most popular programming language
on the internet. It is robust, full bodied, and free. The
language is supported by a world wide network of
volunteers
and exists in versions for many different platforms.
|
|
For the purpose of this tutorial we will be working on a
server running the
Free_BSD
operating system, the
Apache
server, and Perl version 5. You
will need access to Telnet and FTP on your server, a text
editor, and a web browser.
|
|
The Program:
|
#!/usr/local/bin/perl
#
# Maintain a Count File on the Server
#
# Program01 in a series of CGI/Perl Tutorials on
# http://www.thecgibin.com/
# Author : Marty Landman Email : marty@thecgibin.com
#
# You may use and distribute this freely as long as you agree
#
# 1) not to hold Face 2 Interface Inc. or Marty Landman
# responsible for the results of using this software
# 2) to keep these comments intact
#
print 'Counter program beginning to process';
print 'cannot open vcount : ',$!
if not open (COUNT, '+my $counter = ;
print 'Count file has been read - old count = ',$counter;
$counter++;
seek (COUNT, 0, 0) or print $!;
print COUNT $counter;
print 'cannot close vcount : ',$!
if not close (COUNT);
print 'Counter program done processing - new count = ',$counter;
|
|
|
|