aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2020-01-15 23:28:23 -0500
committerHolden Rohrer <hr@hrhr.dev>2020-01-15 23:28:23 -0500
commit0da710f0f1b89ff7ebdbdc8e6b08edb396419eb6 (patch)
treeb9fa5dd4487d8674145b64a0054c24945ea3db9c
parent10e5bbe3b9808a5e2103a7bb416c02ca3e1e35a4 (diff)
./minimun includes tested pdf generator, 404 responder, and get parser
-rwxr-xr-xminimun31
1 files changed, 30 insertions, 1 deletions
diff --git a/minimun b/minimun
index f376d9a..ff00960 100755
--- a/minimun
+++ b/minimun
@@ -5,9 +5,38 @@ use warnings;
use IPC::Run qw(run);
use Time::HiRes qw( time );
+my ($buffer, @pairs, $pair, $name, $val, %FORM);
+
+if ($ENV{'REQUEST_METHOD'} eq "GET") {
+ $buffer = $ENV{'QUERY_STRING'};
+}
+@pairs = split(/&/, $buffer);
+
+foreach $pair (@pairs) {
+ ($name, $val) = split(/=/, $pair);
+ $val =~ tr/+/ /;
+ $val =~ s/%(..)/pack("C", hex($1))/eg;
+ $FORM{$name} = $val;
+}
+
my ($in, $out);
+$in = "\n";
+
+if ($ENV{'PATH_INFO'} eq '/award.pdf'){
+ $in .= "\\award{$FORM{'committee'}}{$FORM{'country'}}{$FORM{'award'}}{$FORM{'school'}}";
+}
+elsif ($ENV{'PATH_INFO'} eq '/room.pdf'){
+ $in .= "\\room{$FORM{'committee'}}";
+}
+else{
+ print "Content-type: text/html\n";
+ print "Status: 404 File Not Found Error\n";
+ print "\n";
+ print '<a href="/">404 Error. Go back.</a>';
+ die;
+}
+
-$in .= "\\award\n";
$in .= "\\bye\n";
my $timestamp = time;