From 44d88a02a3b3d5f646de6cf93adeae04b3a239ea Mon Sep 17 00:00:00 2001
From: peteyboy
Date: Tue, 22 Feb 2022 19:11:41 +0000
Subject: [PATCH] Fixed the unless, the die, and the HTML template for layout
fixes (it was adding a newline every time refreshed)
---
wordle-life.cgi | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/wordle-life.cgi b/wordle-life.cgi
index 8fa0b82..7698502 100755
--- a/wordle-life.cgi
+++ b/wordle-life.cgi
@@ -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__
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 this).
-
@@ -202,8 +202,7 @@ __DATA__
+<%= $rle %>
If the RLE is correct, it should be loaded in the Life Viewer, and so you are ready to go!