hi gurus!
i hav a problem with my cgi script. when i run it from my browser, i get the Premature end of script headers: error. Below is the script.
TIA and GOD bless!

###start

#!/usr/bin/perl -w
use strict;
use CGI qw(:all);
use Fcntl qw(:flock);

#Data location
my $data="";
#semaphore file
my $semaphore_file="/forms/semaphore.smp";

#Lock function
sub get_lock {
        open(SEM, ">$semaphore_file") || die "Cannot create semaphore file: $!";
        flock SEM, LOCK_EX;
}

#Unlock funtion
sub release_lock {
        close(SEM);
}

#Append to data file function
sub append {
        get_lock();
        open(DT, ">>$data") || die "Cannot open $data: $!";
        print DT "name: " param('name'), "\n";
        print DT "position: " param('position'), "\n";
        close(DT);
        release_lock();
}

#Display function for minimal html formatting
sub display {
        open(DT, "$data") || die "Cannot open $data: $!";
        while(<DT>) {
                print "<b>$_</b><br>";
                my($name,$position);
                $name=<DT>;
                $position=<DT>;
                print "$name<br />";
                print "$position<br />";
        }
        close(DT);
}

print header();
if (defined param('submit')) {
        append;
        display;
} else {

###end
-- 
Glenn 

--
Philippine Linux Users' Group (PLUG) Mailing List
[EMAIL PROTECTED] (#PLUG @ irc.free.net.ph)
Official Website: http://plug.linux.org.ph
Searchable Archives: http://marc.free.net.ph
.
To leave, go to http://lists.q-linux.com/mailman/listinfo/plug
.
Are you a Linux newbie? To join the newbie list, go to
http://lists.q-linux.com/mailman/listinfo/ph-linux-newbie

Reply via email to