spsp

Repository for the "Simplified Perl Status Poster" (SPSP).
git clone git://git.samirparikh.com/spsp
Log | Files | Refs | README

commit 3c75a6d0eab4595aecddf45d91d04f79c5871985
parent 5bc46b58c0f7903a5956e41fea739a83b56f15f4
Author: Samir Parikh <noreply@samirparikh.com>
Date:   Thu,  9 Feb 2023 17:08:19 +0000

update spsp to now also update and redirect user to posts.html

Diffstat:
Mcgi/spsp.cgi | 26++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/cgi/spsp.cgi b/cgi/spsp.cgi @@ -136,7 +136,10 @@ rename $POST_DATA_TEMP_FILENAME, $POST_DATA_FILENAME open $temp_filehandle, '>', $POSTS_TEMP_HTML_FILENAME or die "Cannot open $POSTS_TEMP_HTML_FILENAME for writing: $!\n"; -print $temp_filehandle <<"EOF"; +### change default output filehandle +select $temp_filehandle; + +print <<"EOF"; <!DOCTYPE html> <html lang="en"> @@ -153,15 +156,22 @@ print $temp_filehandle <<"EOF"; <h2>$APPLICATION</h2> <h1>$HEADING</h1> <hr> -<p>My first paragraph.</p> -<p>My second paragraph</p> -</body> - -</html> EOF -### TODO: populate the rest of the temporary posts html file using the data -### already stored in @posts +foreach my $post ( @posts ) +{ + print "<p><strong><a href=\"$post->{ $ID }.html\">$post->{ $TITLE }</a></strong>\n" + unless ( $post->{ $TITLE } eq '' ); + print "<p>$post->{ $STATUS }\n"; + print "<p><a href=\"$post->{ $ID }.html\">$post->{ $TIMESTAMP }</a>\n"; + print "<hr>\n"; +} + +print "</body>\n"; +print "</html>\n"; + +### change back to default output filehandle +select STDOUT; ### close the temporary file close $temp_filehandle or die "Error closing $POSTS_TEMP_HTML_FILENAME: $!\n";