diff options
author | Holden Rohrer <hr@hrhr.dev> | 2020-01-15 23:28:23 -0500 |
---|---|---|
committer | Holden Rohrer <hr@hrhr.dev> | 2020-01-15 23:28:23 -0500 |
commit | 0da710f0f1b89ff7ebdbdc8e6b08edb396419eb6 (patch) | |
tree | b9fa5dd4487d8674145b64a0054c24945ea3db9c | |
parent | 10e5bbe3b9808a5e2103a7bb416c02ca3e1e35a4 (diff) |
./minimun includes tested pdf generator, 404 responder, and get parser
-rwxr-xr-x | minimun | 31 |
1 files changed, 30 insertions, 1 deletions
@@ -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; |