Removed unneeded uses, removed commented out List implementation before

I used smartmatch instead.

Updated README. md specific to mojo branch
 On branch mojo
 Changes to be committed:
	modified:   README.md
	modified:   wordle-life.cgi
This commit is contained in:
peteyboy 2022-04-20 06:37:05 +00:00
parent 38585f0b71
commit c644fba146
2 changed files with 6 additions and 12 deletions

View File

@ -2,8 +2,11 @@
one-page app that turns wordle shares into standard file format used in the Conway's Game of Life community and sets it up for running in embedded Lifeviewer on the same page
## Dependencies
This version was rewritten to what I meant to do in the first place, use Mojolicious Lite and take advantage of PATH_INFO routing, so it is simpler. You should be able to run it in any environment where CGI is properly passed the PATH_INFO (SDF has not configured its nginx setup to do so).
This single CGI file is expecting to be run out of the /cgi-bin directory. to change the location, you should update $ORIGIN_PAGE to what you expect. You also may need to change the path to /lv-plugin.js in the <script> tags of the html templates in the __DATA__ section.
This app is not at all packaged. You'll have to make sure all the perl modules you need are installed. If you are on a community unix server with just user rights (like, say SDF), you may need to ask an admin to install for you, or alternately, you can make a personal perl library in your user space.
Here's what I used to [install the perl module I needed with cpanm](https://stackoverflow.com/questions/2980297/how-can-i-use-cpan-as-a-non-root-user). It's just:
@ -15,13 +18,7 @@ Here's what I used to [install the perl module I needed with cpanm](https://stac
then for each package, you can run *cpanminus*:
$> cpanm CGI::Tiny
...
$> cpanm Mojo::Template
...
$> cpnam Mojo::Loader
...
$> cpanm Readonly
$> cpanm Mojolicious::Lite
...
Also, the Life Viewer is a super-cool javascript plugin app from the people at [Conwaylife.com](https://conwaylife.com) that is expected to be in the same directory as the CGI file. It is available with instructions [here](https://conwaylife.com/wiki/Tutorials/LifeViewer_JavaScript_plug-in)

View File

@ -3,8 +3,6 @@ use strict;
use warnings;
use utf8;
use Mojolicious::Lite -signatures;
use Readonly;
use List::Util qw(first);
use experimental 'smartmatch';
@ -12,7 +10,7 @@ use experimental 'smartmatch';
# MAKE SURE ORIGIN PAGE MATCHES FILENAME (especially if you are testing changes)!
#
#===
my $ORIGIN_PAGE = "/cgi-bin/wordle-life-mojo.cgi";
my $ORIGIN_PAGE = "/cgi-bin/wordle-life.cgi";
my $defaulttext = "Paste your wordle share here (replace this text)";
my $PATH_PARAM = "PATH_INFO";
my $WORDLE_INPUT_PARAM = "wordle-result";
@ -44,7 +42,6 @@ get '/' => sub ($cgi) {
get '/*path_info' => sub ($cgi) {
my $template_name = $cgi->stash("path_info");
#TODO: Check against a list of valid templates!
#if ( grep ( /^$template_name$/, ('index', 'about') )) {
if ( $template_name ~~ ['about'] ) {
$cgi->stash( ORIGIN_PAGE => $ORIGIN_PAGE); #this isn't general purpose, what template needs what variables?
}else{ #TODO: fix so as not to need copied code from the else below?