Created
October 29, 2013 19:44
-
-
Save drj42/7221275 to your computer and use it in GitHub Desktop.
Mojolicious ingress cemetery portal name generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Mojolicious::Lite; | |
# Instructions: | |
# $ cpanm Mojolicious | |
# $ morbo grave_names.pl | |
# | |
# browse to http://localhost:3000 | |
# Documentation browser under "/perldoc" | |
# plugin 'PODRenderer'; | |
my @adjectives = ( | |
"lonely", "little", "blackstone", "headless","decapitated","defecating","brony" | |
); | |
my @verbs = ( | |
"watching", "weeping","looking", "staring", "heaving", "crying","sitting","sleeping","stalking","shaving" | |
); | |
my @subjects = ( | |
"woodmen","child","lamb","sheep","tony","hammer","stache" | |
); | |
my @nouns = ( | |
"mausoleum", "memorial", "grave marker","headstone","stump","burial site" | |
); | |
get '/' => sub { | |
my $me = shift; | |
my $name = generate_name(); | |
$me->stash(name => $name); | |
$me->render('index'); | |
}; | |
sub rand_el { $_[int(rand(@_))] } | |
sub generate_name { | |
join " ", (ucfirst rand_el(@adjectives), | |
ucfirst rand_el(@verbs), | |
ucfirst rand_el(@subjects), | |
ucfirst rand_el(@nouns)) | |
} | |
app->start; | |
__DATA__ | |
@@ index.html.ep | |
% layout 'default'; | |
% title 'Refresh the page to get a new name!'; | |
<strong><%= $name %></strong> | |
<br /> | |
<br /> | |
<a href="/">generate another</a> | |
@@ layouts/default.html.ep | |
<!DOCTYPE html> | |
<html> | |
<head><title><%= title %></title></head> | |
<body><%= content %></body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment