#! /usr/local/bin/perl ################################# # # WeddingPlanner CGI # # Written by Zach Whalen -- # (zwhalen@english.ufl.edu) # # Please contact me if you use this # program or if you have any questions. # # Copyleft Zach Whalen 2003 # You can use this program if # you want to. Just don't try to # Copyright it yourself, please. # ################################# ### SUMMARY ### # # This is part of a script which helps you # keep up with addresses and other related # information when you're planning a wedding # (or conference). # alarm(30); use strict; print "Content-type: text/html \n\n"; require '/web/nwe/share/nwe.pm'; my @datfiles = glob "*.dat"; my @Sorted = sort (@datfiles); my $Total = 0; my @Array; foreach (@Sorted) { my %hash = &make_hash($_); push @Array, $hash{group}; } my $Total = &Total(@Array); my @Entries; foreach (@Sorted) { my %hash = &make_hash($_); push @Entries, 1; } my $entries = &Total(@Entries); my @invitations_sent; foreach (@Sorted) { my %hash = &make_hash($_); if ($hash{invite}){ push @invitations_sent, 1; }else{ next; } } my $sent = &Total(@invitations_sent); my @Party; foreach (@Sorted) { my %hash = &make_hash($_); push @Party, $hash{party}; } my $invited = &Total(@Party); my @RSVPS; foreach (@Sorted) { my %hash = &make_hash($_); if ($hash{RSVP}){ push @RSVPS, 1; }else{ next; } } my $rsvps = &Total(@RSVPS); print <

These are all the files you've entered so far:

Enter a new file.

View just the addresses to make mailing labels.

Print all of the email addresses so you can cut and paste them.

Statistics

So far, $Total people have said they are coming!

START_OF_HTML foreach (@Sorted){ my %hash = &make_hash($_); $hash{address} =~ s/^M/
/g; $hash{others} =~ s/,/
/g; my $file = $hash{surname}.".dat"; print <$hash{surname}
MIDDLE_OF_HTML } print <

Last Name First Name # in party Other's names Mailing Address E-Mail Inv. sent? RSVPed? RSVP # Gift Thank-you sent?
$hash{firstname} $hash{party} $hash{others} $hash{address1}
$hash{address2}
$hash{city}$hash{state} $hash{zip}
$hash{email} $hash{invite} $hash{RSVP} $hash{group} $hash{gift} $hash{thank}
Statistics!
Number of entries so far:$entries
Number of invitations sent:$sent
Number of people invited:$invited
Number of RSVP's received:$rsvps
Number of people coming:$Total
Back to the Top
END_OF_HTML sub make_hash { my ($key, $val, %hash); my $filename = $_[0]; open READ, "$filename" or return 0; my @file = ; close READ; foreach (@file){ chomp $_; ($key, $val) = split /=/,$_; $hash {$key}=$val; } return %hash; } sub Total { my $Sum; foreach (@_) { $Sum += $_; } return $Sum; }