#!/usr/local/bin/perl # Dilip Barman, http://www.cs.unc.edu/Courses/wwwp-f97/members/barman # Sep 22 1997 # # dbDeleteRecordDoIt2.pl.cgi: See my perl project described at # www.cs.unc.edu/Courses/wwwp-f97/members/barman/perlProjectProposal.html. # This is just about the last code I should need to write and simply # deletes a record from the database. No error checking is necessary # since the user has picked a record from the database and confirmed its # deletion. This is called from dbDeleteRecord2.pl.cgi and simply # deletes the record and puts up a screen that it is done. require "/afs/cs.unc.edu/project/courses/190-25f97/programs/perl/lib/cgi-lib.pl"; # GLOBAL VARIABLES $FALSE = 0; $TRUE = 1; # $DBFILENAME = "../musicDatabase/musicDB2"; # name of DBM database file $DBFILENAME = "/afs/cs.unc.edu/project/courses/190-25f97/members/barman/musicDatabase/musicDB2"; $ROACCESS = "0555"; # Read-Only open: RWX, so U=101, G=101, O=101 $RWACCESS = "0777"; # Read-Write open: 111 111 111 # Remember to set AFS directory permissions so system:anyuser (a web # client, for example) has write privilege to this directory -- # fs setat ../musicDatabase system:anyuser write # * * * P R O C E S S U S E R I N P U T * * * &ReadParse(*input); # Store input as attrib-value keys in variable input # Now $input[0] looks like "AlbumTitle=Yes, Delete!" $_ = $input[0]; @words = split(/=/, $_); $title = $words[0]; # Convert hex to normal chars $title =~ s/%([0-9][0-9])/pack("c", hex($1)) /ge; # * * * T O P L E V E L H T M L S T U F F * * * print &PrintHeader; print "
"; print "\nThe record has been deleted."; print "\n
Return to main screen"; # * * * W R A P U P H T M L * * * print "\n