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
1 changed files with 8 additions and 9 deletions

View File

@ -51,8 +51,9 @@ use Readonly;
#textarea name, pull the value from POST and reload into textarea
$wordle = $cgi->body_param('wordle-result');
#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
if ($wordle =~ /^#[Cc] /){
$rle = $wordle;
@ -67,7 +68,7 @@ use Readonly;
exit;
}
die "Invalid wordle parameter" unless length $wordle;
#die "Invalid wordle parameter" unless length $wordle;
#Load template from DATA section and output
my $mt = Mojo::Template->new(auto_escape => 1, vars => 1);
@ -83,7 +84,7 @@ use Readonly;
sub generate_rle {
my $headline = "";
my $rleline;
my $rleline = "";
my $rowcount;
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>
<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>
<textarea id="wordle" name="wordle-result" rows="9" cols="50" placeholder="<%= $defaulttext =%>" style="vertical-align: middle class="lv-rle"">
<%= $wordle %>
</textarea>
<textarea id="wordle" name="wordle-result" rows="9" cols="50" placeholder="<%= $defaulttext %>" style="vertical-align: middle class="lv-rle"">
<%= $wordle %></textarea>
</p>
<br>
</li>
@ -202,8 +202,7 @@ __DATA__
</label>
<textarea id="life" name="life-file" rows="9" cols="50" style="vertical-align: middle" class="lv-rle" class="flow">
<%= $rle %>
</textarea>
<%= $rle %></textarea>
<p>If the RLE is correct, it should be loaded in the Life Viewer, and so you are ready to go!</p>
<ul>