From 05be095d9944be899c8fa0c1c56ac6b9a6c145f1 Mon Sep 17 00:00:00 2001 From: Naglfar Date: Tue, 21 Mar 2023 18:20:30 +0000 Subject: Add CGI index of contents in Perl programming language --- index.cgi | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 index.cgi (limited to 'index.cgi') diff --git a/index.cgi b/index.cgi new file mode 100755 index 0000000..cbcf385 --- /dev/null +++ b/index.cgi @@ -0,0 +1,78 @@ +#!/usr/bin/perl -wT + +# breaks up a string according to a separator +@uri = split('/', $ENV{REQUEST_URI}); +if ( $#uri > -1 && -e "/openwcms/data/$uri[1].html" ) +{ + $request = "$uri[1]"; +} +else +{ + $request = 'main'; +} + +require '/openwcms/include/add_items.pl'; +# domain is always the first thing in the string, pick the first element +$domain = (split /\./, $head[0]{href})[0]; + +print "Content-type: text/html\n\n"; +print < + + + + + + $head[0]{title} - $domain + + + + +
+ + + +
+eof +open (FH, "/openwcms/data/$request.html"); +while ($line = ) +{ + chomp $line; # to remove the last trailing newline + print $line; +} +close (FH); + +print < + + + +
+ + + + + +eof -- cgit v1.2.3