From 09ca3a1116e8e6c253738a4c53c43db8caa317b1 Mon Sep 17 00:00:00 2001 From: Will Budic Date: Fri, 12 Sep 2025 10:17:59 +1000 Subject: [PATCH] Added stagging section. --- README.md | 120 +++++++++++++ docs/PerlCNFWEBServer_Reminder_Plans.md | 10 +- install_cpan_modules_required.pl | 220 ------------------------ install_modules.pl | 1 + server.cnf | 4 +- server.pl | 5 +- tests/staging/effects_svg.css | 36 ++++ tests/staging/main copy.html | 82 +++++++++ tests/staging/main.css | 36 ++++ tests/staging/main.html | 214 +++++++++++++++++++++++ tests/staging/readme.md | 4 + 11 files changed, 505 insertions(+), 227 deletions(-) create mode 100644 README.md delete mode 100755 install_cpan_modules_required.pl create mode 120000 install_modules.pl create mode 100644 tests/staging/effects_svg.css create mode 100644 tests/staging/main copy.html create mode 100644 tests/staging/main.css create mode 100644 tests/staging/main.html create mode 100644 tests/staging/readme.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..002d37d --- /dev/null +++ b/README.md @@ -0,0 +1,120 @@ +# PerlCNFWebServer Readme And Notes + +## About + +This project is an full Perl webserver implementation utilized to provide for sophisticated modern direct client server development. It's [specification](specs.md) will provide for you more information of exact its features. + +## Installation + +This project requires the PerlCNF project to be installed first. After this installation and all its tests have passed. Further installation of PerlCNFServer then can proceed; to get the server running. + +Before installation it is recommended to update to latest Perl version that is system thread enabled. A single process distro Perl is an CGI type of solution. Not suitable or compatible with modules of this project. + +Best is to reinstall to any Perl v.5.38 and up, on system level (not local or brew level). Then work by installing and testing further on modules into it. + +Notice, this all will further on can take quite a long time. Watch some video, have a coffee, while you run all this in the background. +Especially extra time expect, if updating Perl via building from source. Which is an recommended approach for production based environments. + +``` +perl -V +``` +**Example Mine Current Output:** +``` +will@nomad$ perl -V +Summary of my perl5 (revision 5 version 40 subversion 2) configuration: + + Platform: + osname=linux + osvers=6.8.0-62-generic + archname=x86_64-linux-thread-multi + uname='linux nomad 6.8.0-62-generic #65-ubuntu smp preempt_dynamic mon may 19 17:15:03 utc 2025 x86_64 x86_64 x86_64 gnulinux ' + config_args='-des -Dcc=gcc -Duse64bitall -Duselargefiles -Dusethreads -Duseshrplib' + ... +Characteristics of this binary (from libperl): + Compile-time options: + HAS_LONG_DOUBLE + HAS_STRTOLD + HAS_TIMES + MULTIPLICITY + PERLIO_LAYERS + PERL_COPY_ON_WRITE + PERL_DONT_CREATE_GVSV + PERL_HASH_FUNC_SIPHASH13 + PERL_HASH_USE_SBOX32 + PERL_MALLOC_WRAP + PERL_OP_PARENT + PERL_PRESERVE_IVUV + PERL_USE_SAFE_PUTENV + USE_64_BIT_ALL + USE_64_BIT_INT + USE_ITHREADS + USE_LARGE_FILES + USE_LOCALE + USE_LOCALE_COLLATE + USE_LOCALE_CTYPE + USE_LOCALE_NUMERIC + USE_LOCALE_TIME + USE_PERLIO + USE_PERL_ATOF + USE_REENTRANT_API + USE_THREAD_SAFE_LOCALE + Built under linux + Compiled at Jul 18 2025 07:51:16 + @INC: + /usr/local/lib/perl5/site_perl/5.40.2/x86_64-linux-thread-multi + /usr/local/lib/perl5/site_perl/5.40.2 + /usr/local/lib/perl5/5.40.2/x86_64-linux-thread-multi + /usr/local/lib/perl5/5.40.2 +``` + + + + +### Install PerlCNF Project + +1. Using git in a directory of own choice checkout the project. + ``` + mkdir ~/dev; cd ~/dev; + git clone git://lifelog.hopto.org/`PerlCNF + ``` +2. Run the install modules scripts. + ``` + cd ~/dev/PerlCNF; + ./install_cpan_INSTALL_PREPARE_PROJECT_SETUP_FIRST.sh; + sudo install_cpan_modules_required.pl; + ``` +3. Run the tests. + ``` + cd ~/dev/PerlCNF; + perl tests/testAll.pl + ``` + +### Install PerlCNFWebServer + +1. Using git in a directory of own choice checkout the project. + ``` + mkdir ~/dev; cd ~/dev; + git clone git://lifelog.hopto.org/`PerlCNF + cd PerlCNFWebServer + ``` +2. Proceed with its README.md, which this file is most likely, lol. +3. Establish/rewrite required symbolic links. + 1. PerlCNF Project is linked so if it updates the PerlCNFWebServer obtains the latest. + - PerlCNF Project will not be committed to the upstream branch, if it breaks the current PerlCNFWebServer.. + - If get errors update your PerlCNFWebServer project. + ``` + cd ~/dev/PerlCNFServer; + git pull + ``` + 2. Replace -> **/home/will/dev/PerlCNF** with your local path of the PerlCNF installation, which is not necessary an home directory. + ``` + cd ~/dev/PerlCNFWebServer + ln -s /home/will/dev/PerlCNF/system system; + ln -s /home/will/dev/PerlCNF/install_cpan_modules_required.pl install_modules.pl; + ``` +4. Run its install modules (its a link to the script in PerlCNF). + 1. Notice - must cd into the PerlCNFWebServer! Do not path to it. + ``` + cd ~/dev/PerlCNFWebServer; + sudo install_modules.pl + ``` diff --git a/docs/PerlCNFWEBServer_Reminder_Plans.md b/docs/PerlCNFWEBServer_Reminder_Plans.md index f532b3f..1ce85ce 100644 --- a/docs/PerlCNFWEBServer_Reminder_Plans.md +++ b/docs/PerlCNFWEBServer_Reminder_Plans.md @@ -19,8 +19,9 @@ ## Current Tasks In Waiting -- [ ] Create GitWeb Repository for PerlCNFWebServer. -- [ ] Make it public available. +- [x] Create GitWeb Repository for PerlCNFWebServer. +- [x] Make it public available. + --- @@ -30,7 +31,7 @@ |Doc Origin | https://lifelog.hopto.org | |Doc Created| 2025-05-15 | |Doc Last Updated| 2025-05-15 15:54:41 | -- TOC +- TOC @@ -44,3 +45,6 @@ [^PerlCNF]: PerlCNF Project [PerlCNF Project Repository](https://lifelog.hopto.org/gitweb/?p=PerlCNF.git;a=tree;h=refs/heads/master;hb=refs/heads/master) by Will Budić + + +2025-05-16 06:45:00 diff --git a/install_cpan_modules_required.pl b/install_cpan_modules_required.pl deleted file mode 100755 index 65bb0ea..0000000 --- a/install_cpan_modules_required.pl +++ /dev/null @@ -1,220 +0,0 @@ -#!/usr/bin/env perl -## -# Module installer for projects. -# Run this script from any Project directory containing perl modules or scripts. -## -use warnings; use strict; -### -# Prerequisites for this script itself. Run first: -# cpan Term::ReadKey; -# cpan Term::ANSIColor; -## no critic (ProhibitStringyEval) -use Term::ReadKey; -use Term::ANSIColor qw(:constants); - -use constant PERL_FILES_GLOB => "*local/*.pl local/*.pm system/modules/*.pm tests/*.pm tests/*.pl *.pl *.pm *.cgi"; - -my $project = `pwd`."/".$0; $project =~ s/\/.*.pl$//g; $project =~ s/\s$//g; -my @user_glob; -our $PERL_VERSION = $^V->{'original'}; my $ERR = 0; my $key; - -print WHITE "\n *** Project Perl Module Installer coded by ",BRIGHT_RED, "https://github.com/wbudic", WHITE,"***", qq( - \nRunning scan on project path:$project - \nYou have Perl on $^O [$^X] version: $PERL_VERSION\n -); -print BLUE "<<@<\@INC<\n# Your default module package paths:\n", YELLOW; -local $. = 0; foreach(@INC){ - print $.++.".: $_\n"; -} -print BLUE ">>\n", RESET; -if($> > 0){ - print "You are NOT installing system wide, which is required for webservers CGI.\nAre you sure about this?\n" -}else{ - print "You are INSTALLING modules SYSTEM WIDE, are you sure about this?\n" -} -if(@ARGV==0){ - print qq(\nThis program will try to figure out now all the modules - required for this project, and install them if missing. - This can take some time. - ); - print RED "Do you want to proceed (press either the 'Y'es or 'N'o key)?", RESET; - -do{ - ReadMode('cbreak'); - $key = ReadKey(0); print "\n"; - ReadMode('normal'); - exit 1 if(uc $key eq 'N'); - $key = "[ENTER]" if $key =~ /\n/; - print "You have pressed the '$key' key, that is nice, but why?\nOnly the CTRL+C/Y/N keys do something normal." if uc $key ne 'Y'; - }while(uc $key ne 'Y'); -} -else{ - foreach(@ARGV){ - if(-d $_){ - $_ =~ s/\s$//g; - print "\nGlobing for perl files in $project/$_"; - my @located = glob("$_/*.pl $_/*.pm"); - print " ... found ".@located." files."; - push @user_glob, @located; - - }else{ - warn "Argument: $_ is not a local directory." - } - } -} - -my @locals=(); -print "\nGlobing for perl modules in project $project"; -my @perl_files = glob(PERL_FILES_GLOB); -print " ... found ".@perl_files." files.\n"; -push @perl_files, @user_glob; -my %modules; my %localPackages; -foreach my $file(@perl_files){ - next if $0 =~ /$file$/; - if($file =~ /(\w*)\.pm$/){ - $localPackages{$1}=$file; - } - print "\nExamining:$file\n"; - my $res = `perl -ne '/\\s*(^use\\s([a-zA-Z:]*))\\W/ and print "\$2;"' $file`; - my @list = split(/;+/,$res); - foreach(@list){ - if($_=~ /^\w\d\.\d+.*/){ - print "\tA specified 'use $_' found in ->$file\n"; - if($PERL_VERSION ne $_){ - $_ =~s/^v//g; - my @fv = split(/\./, $_); - $PERL_VERSION =~s/^v//g; - my @pv = split(/\./, $PERL_VERSION); - push @fv, 0 if @fv < 3; - for my$i(0..$#fv){ - if( $pv[$i] < $fv[$i] ){ - $ERR++; print "\n\t\033[31mERROR -> Perl required version has been found not matching.\033[0m\n"; - last - } - } - } - } - } - foreach(@list){ - $_ =~ s/^\s*|\s*use\s*//g; - $_ =~ s/[\'\"].*[\'\"]$//g; - next if !$_ or $_ =~ /^[a-z]|\d*\.\d*$|^\W/; - $_ =~ s/\(\)|\(.*\)|qw\(.*\)//g; - $modules{$_}=$file if $_; - print "$_\n"; - } - if($file=~/\.pm$/){# it is presumed local package module. - $locals[@locals] = `perl -ne '/\\s*(^package\\s(\\w+))/ and print "\$2" and exit' $file`; - } -} - -print WHITE "\nList of Modules required for thie project:\n"; -my @missing=(); -foreach my $mod (sort keys %modules){ - my $missing; - eval "use $mod"; - if ($@){ - $missing[@missing] = $mod; - print MAGENTA "\t$mod \t in ", $modules{$mod}," is suspicious?\n"; - }else{ - print BLUE "\t$mod\n" - } -}foreach(@missing){ - if(exists $localPackages{$_}){ - delete $modules{$_} - }else{ - print BRIGHT_RED $_, MAGENTA, " is missing!\n" - } -} -my %skip_candidates; -my $missing_count = @missing; -if($missing_count>0){ - foreach my $candidate(@missing){ - foreach(@locals){ - if($_ eq $candidate && not exists $skip_candidates{$_}){ - $missing_count--; - $skip_candidates{$_} = 1; - print GREEN, "Found the missing $candidate module in locals.\n" - } - } - } -} -my $perls = `whereis perl`; -print GREEN, "Following is all of ",$perls; -print YELLOW, "Reminder -> Make sure you switched to the right brew release.\n" if $perls =~ /perlbrew/; -print RESET, "Number of local modules:",scalar(@locals),"\n"; -print RESET, "Number of external modules:",scalar(keys %modules),"\n"; -print RESET, "Number of cpan modules about to be tried to install:",$missing_count,"\n"; - -print GREEN, qq( -Do you still want to continue to compile/test/install or check further modules? -Only the first run is the depest and can take a long time, i.e. if you have to install over 5 modules. -At other times this will only check further your current status. - -Now (press either the 'Y'es or 'N'o key) please?), RESET; -do{ -ReadMode('cbreak'); -$key = ReadKey(0); print "\n"; -ReadMode('normal'); - exit 1 if(uc $key eq 'N'); - $key = "[ENTER]" if $key =~ /\n/; - print "You have pressed the '$key' key, that is nice, but why?\nOnly the CTRL+C/Y/N keys do something normal.\n" if uc $key ne 'Y'; -}while(uc $key ne 'Y'); - -my ($mcnt,$mins) = (0,0); -my @kangaroos = sort keys %skip_candidates; - -## -# Some modules if found to be needed to be forcefeed. can be hardcoded here my friends, why not? -## -foreach (( - 'LWP::Simple', - 'LWP::Protocol::https', - 'XML::LibXML::SAX' -)){ - $modules{$_}=1; print "Forcefeed: $_\n" -} - -MODULES_LOOP: -foreach my $mod (sort keys %modules){ - - foreach(@kangaroos){ - if($_ eq $mod){ - next MODULES_LOOP - } - } - $mcnt++; - ## no critic (ProhibitStringyEval) - eval "use $mod"; - if ($@) { - system(qq(perl -MCPAN -e 'install $mod')); - if ($? == -1) { - print "failed to install: $mod\n"; - }else{ - my $v = eval "\$$mod\::VERSION"; - $v = $v ? "(v$v)" : ""; - print "Installed module $mod $v!\n"; - $mins++ - } - }else{ - $mod =~ s/\s*$//; - my $v = eval "\$$mod\::VERSION"; - $v = $v ? "(v$v)" : ""; - print "Skipping module $mod $v, already installed!\n"; - } -} -print "\nProject $project\nRequires $mcnt modules.\nInstalled New: $mins\n"; -print "WARNING! - This project requires in ($ERR) parts code that might not be compatible yet with your installed/running version of perl (v$PERL_VERSION).\n" -if $ERR; - - -=begin copyright -Programed by : Will Budic -EContactHash : 990MWWLWM8C2MI8K (https://github.com/wbudic/EContactHash.md) -Source : https://github.com/wbudic/PerlCNF.git -Documentation : Specifications_For_CNF_ReadMe.md - This source file is copied and usually placed in a local directory, outside of its repository project. - So it could not be the actual or current version, can vary or has been modiefied for what ever purpose in another project. - Please leave source of origin in this file for future references. -Open Source Code License -> https://github.com/wbudic/PerlCNF/blob/master/ISC_License.md -=cut copyright diff --git a/install_modules.pl b/install_modules.pl new file mode 120000 index 0000000..235f568 --- /dev/null +++ b/install_modules.pl @@ -0,0 +1 @@ +/home/will/dev_new/PerlCNF/install_cpan_modules_required.pl \ No newline at end of file diff --git a/server.cnf b/server.cnf index 94efc6b..faa549d 100644 --- a/server.cnf +++ b/server.cnf @@ -16,8 +16,8 @@ <<@<%SSL> server = 1 use_cert = 1 - cert_file = /etc/letsencrypt/live/lifelog.hopto.org/fullchain.pem - key_file = /etc/letsencrypt/live/lifelog.hopto.org/privkey.pem + cert_file = data/ssl_cert/example.crt + key_file = data/ssl_cert/example.key enabled : yes >> diff --git a/server.pl b/server.pl index 98d1cd5..1323a08 100755 --- a/server.pl +++ b/server.pl @@ -1,5 +1,6 @@ #!/usr/bin/perl -package PerlCNFWebServer; +package PerlCNFWebServer; +#Requirements symbolic link to PerlCNF project: cd PerlCNFWebServer; ln -s /home/will/PerlCNF/system/ system use lib::relative 'system/modules'; use lib::relative 'apps'; use PerlCNFWebServerBase; @@ -307,7 +308,7 @@ sub accept_hook { SSL_cert_file => $SSL{cert_file}, SSL_key_file => $SSL{key_file}, ) - or warn "problem setting up SSL socket: " . IO::Socket::SSL::errstr(); + or warn "Problem setting up SSL socket: " . IO::Socket::SSL::errstr(); $self->stdio_handle($newfh) if $newfh; } } diff --git a/tests/staging/effects_svg.css b/tests/staging/effects_svg.css new file mode 100644 index 0000000..5862d67 --- /dev/null +++ b/tests/staging/effects_svg.css @@ -0,0 +1,36 @@ +@keyframes spin { + to { + transform: rotate(360deg); + } +} + + +@keyframes spin2 { + 0% { + stroke-dasharray: 1, 800; + stroke-dashoffset: 0; + } + + 50% { + stroke-dasharray: 400, 400; + stroke-dashoffset: -200px; + } + + 100% { + stroke-dasharray: 800, 1; + stroke-dashoffset: -800px; + } +} + +.spin { + transform-origin: center; + animation: spin 2s linear infinite; +} + + +.spin2 { + transform-origin: center; + animation: spin2 1.5s ease-in-out infinite, + spin 2s linear infinite; + animation-direction: alternate; +} \ No newline at end of file diff --git a/tests/staging/main copy.html b/tests/staging/main copy.html new file mode 100644 index 0000000..92b67ff --- /dev/null +++ b/tests/staging/main copy.html @@ -0,0 +1,82 @@ + + + + + + + Main + + + + + + + + +
+ + +
+ One
+ +
+
2025-09-10 12:30:28
+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut + labore + et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut + aliquip + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum + dolore eu + fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia + deserunt mollit anim id est laborum. +

+
+
+ +
+ Three +
+ + + +
+ + + + + \ No newline at end of file diff --git a/tests/staging/main.css b/tests/staging/main.css new file mode 100644 index 0000000..dc156dd --- /dev/null +++ b/tests/staging/main.css @@ -0,0 +1,36 @@ +:root { + color: cornflowerblue; + --cnf-tag: #FFD700; + --cnf-ins: cornsilk; + --cnf-prp: cornflowerblue; + --def-col: black; +} + +body { + font-family: Lato; + display: flow-root; + padding: 0.5em; + background-color: #8dd8e7; + color: var(--def-col); +} + +@font-face { + font-family: "Lato"; + src: url(../../web_sources/fonts/Lato/Lato-Regular.ttf); +} + +/* Styles for tablets and smaller screens */ +@media (max-width: 768px) { + .content { + border: solid black 1px; + } +} + +/* Styles for mobile devices */ +@media (max-width: 480px) { + .content { + padding: 10px; + border: solid red 2px; + } +} + diff --git a/tests/staging/main.html b/tests/staging/main.html new file mode 100644 index 0000000..92370b3 --- /dev/null +++ b/tests/staging/main.html @@ -0,0 +1,214 @@ + + + + + + + Main + + + + + + + +
+ +
+

List Sample 1

+
    +
  • One
  • +
  • Two
  • +
  • Three
  • +
  • Four
  • +
+

List Sample 2

+ +
    +
  • One
  • +
  • Two
  • +
  • Three
  • +
  • Four
  • +
+ +

List Sample 3

+ +
    +
  1. One
  2. +
  3. Two
  4. +
  5. Three
  6. +
  7. Four
  8. +
+
+ +
+ +
+ + + + + +
+
+
2025-09-10 12:30:28
+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut + labore + et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut + aliquip + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum + dolore eu + fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia + deserunt mollit anim id est laborum. +

+
+
+
+ +
+ +
+ +

EMPTY

+ +
+ +
+ +
+ + + + + + + +
+

There is a pussy is on t-shirt Stussy!

+
+
+ +
+ + +
+ +

List Sample 4

+
    +
  1. -
  2. +
  3. --
  4. +
  5. ---
  6. +
  7. ----
  8. +
+

List Sample 4

+ +
+ + + +
+ + +
+ + + + + + + +
+
+ +

1234

+
+ +
+ +
+ +
+ +
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut + labore + et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut + aliquip + +
+ +
+ + +
+ + + + + \ No newline at end of file diff --git a/tests/staging/readme.md b/tests/staging/readme.md new file mode 100644 index 0000000..88ccaa3 --- /dev/null +++ b/tests/staging/readme.md @@ -0,0 +1,4 @@ +#About This Folder + + This folder is to stage and build on css and html templates. + \ No newline at end of file -- 2.34.1