Fixed the unless, the die, and the HTML template for layout fixes (it was adding a newline every time refreshed)

This commit is contained in:
peteyboy 2022-02-22 19:11:41 +00:00
parent a249bb48d5
commit 44d88a02a3

View File

@ -51,8 +51,9 @@ use Readonly;
#textarea name, pull the value from POST and reload into textarea #textarea name, pull the value from POST and reload into textarea
$wordle = $cgi->body_param('wordle-result'); $wordle = $cgi->body_param('wordle-result');
#if input textarea not changed from default text, do nothing #if input textarea not changed from default text, do nothing
unless ($wordle =~ /\Q$defaulttext\E/) { unless ($wordle =~ /\Q$defaulttext\E/ or $wordle eq '') {
#[Cc] /){ #cheat, if they put in something that looks like an RLE, pass output through #[Cc] /){ #cheat, if they put in something that looks like an RLE, pass output through
if ($wordle =~ /^#[Cc] /){ if ($wordle =~ /^#[Cc] /){
$rle = $wordle; $rle = $wordle;
@ -67,7 +68,7 @@ use Readonly;
exit; exit;
} }
die "Invalid wordle parameter" unless length $wordle; #die "Invalid wordle parameter" unless length $wordle;
#Load template from DATA section and output #Load template from DATA section and output
my $mt = Mojo::Template->new(auto_escape => 1, vars => 1); my $mt = Mojo::Template->new(auto_escape => 1, vars => 1);
@ -83,7 +84,7 @@ use Readonly;
sub generate_rle { sub generate_rle {
my $headline = ""; my $headline = "";
my $rleline; my $rleline = "";
my $rowcount; my $rowcount;
my $myline; my $myline;
@ -179,12 +180,11 @@ __DATA__
<p> Paste your wordle share below and submit to convert it to a Conway's Life file so you can run it (to learn more about Conway's Life, read <a href=https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life> this)</a>.</p> <p> Paste your wordle share below and submit to convert it to a Conway's Life file so you can run it (to learn more about Conway's Life, read <a href=https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life> this)</a>.</p>
<form id="wordle-form" name="wordle-form" action="<%= $ORIGIN_PAGE =%>" method="POST" class="flow"> <form id="wordle-form" name="wordle-form" action="<%= $ORIGIN_PAGE %>" method="POST" class="flow">
<label for="wordle">Wordle Share Chart:</label> <label for="wordle">Wordle Share Chart:</label>
<textarea id="wordle" name="wordle-result" rows="9" cols="50" placeholder="<%= $defaulttext =%>" style="vertical-align: middle class="lv-rle""> <textarea id="wordle" name="wordle-result" rows="9" cols="50" placeholder="<%= $defaulttext %>" style="vertical-align: middle class="lv-rle"">
<%= $wordle %> <%= $wordle %></textarea>
</textarea>
</p> </p>
<br> <br>
</li> </li>
@ -202,8 +202,7 @@ __DATA__
</label> </label>
<textarea id="life" name="life-file" rows="9" cols="50" style="vertical-align: middle" class="lv-rle" class="flow"> <textarea id="life" name="life-file" rows="9" cols="50" style="vertical-align: middle" class="lv-rle" class="flow">
<%= $rle %> <%= $rle %></textarea>
</textarea>
<p>If the RLE is correct, it should be loaded in the Life Viewer, and so you are ready to go!</p> <p>If the RLE is correct, it should be loaded in the Life Viewer, and so you are ready to go!</p>
<ul> <ul>