#!/usr/bin/perl
use strict;
[% PROCESS archives.tt -%]
#loads mods for easy web page CGI
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
#Loads a mod for easy file access
use Tie::File;
#Loads a mod used for determining how many pages worth of names there are
use POSIX;
print "Content-type: text/html\n\n";
our $csv_file = '../archives.csv';
our $delete;
our $search;
our $page_start;
our $page_end;
our $host = "$ENV{HTTP_HOST}";
our $edit;
our $current_page = 1;
our @list;
our $top;
our $footer;
our ($url_to_myself, $info) = split (/names.cgi\?/, $ENV{REQUEST_URI});
our $lines_per_page = 3;
our $lines;
our $pages;
#our $lines_in_file = @names;
our ($lines_in_file, undef) = split(/\s/, `wc -l $csv_file`);
our $pages_in_file = ceil($lines_in_file/$lines_per_page);
our @line_number;
our $search_for;
#Puts the information from the end of the url in usable form
my @info = split("&", $info);
foreach my $part(@info){
my ($property, $value) = split("=", $part);
if ($property eq "page"){$current_page = "$value";}
if ($property eq "edit"){$edit = "$value";}
if ($property eq "search"){$search = $value;}
if ($property eq "delete"){$delete = $value;}
}
if ($edit){
edit();
}
elsif ($search && $search ne ""){
$search_for = $search;
search();
page_search();
}
elsif ($delete){
delete_name();
}
else{
page_list();
}
sub top{
if ($search && $search ne ""){
}
else{
tie @list, 'Tie::File', "$csv_file" or print '