#!/usr/bin/perl
#overkill:
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $INCOMING = CGI->new();
#try to save the world:
dodge_bomb();
sub dodge_bomb
{
my $terrorist_detonation = $INCOMING->param("bomb") || "dud";
die "Fatal error! Bombbarded by $terrorist_detonation"
if $terrorist_detonation ne "dud";
#you lucky scoundrel, you...
print "Content-Type: text/html\r\n\r\n";
print <<DOC;
<html>
<head>
<title>It's Da Bomb!</title>
<script type="text/javascript">
function diffuse()
{
var bombList = new Array(
"roses", "frogs", "confetti",
"moths","crickets","pollen",
"love","dud"
);
document.forms[0].bomb.value =
bombList[(Math.round(Math.random() * 7)+0)];
document.forms[0].submit();
}
</script>
</head>
<body>
<h3>Shew! close one...or did you even try to save the world?</h3>
<form id="dudhopeful" action="$ENV{SCRIPT_NAME}" method="post">
<input type="hidden" name="bomb" value="" />
<label for="dbomb">Save the world. Diffuse the bomb!</label>
<input id="dbomb" type="button" onClick="diffuse()" value="!@#" />
</form>
</body>
</html>
DOC
}