#!/usr/bin/perl use strict; use warnings; use Path::Tiny; use autodie; my $gem_header = "20 text/gemini"; #my $dir = path("/var/gemini/thfr.info/cgi-bin"); # adjust path for chroot my $dir = path("."); my $file = $dir->child("testcount.txt"); my $content = $file->slurp_utf8(); # file assumed to only contain integer chomp $content; $content++; my $file_handle = $file->openw_utf8(); $file_handle->print($content); close $file_handle; print "$gem_header\r\n"; print "This file has been viewed $content times"; gemini://thfr.info/cgi-source/testcounter.cgi

-- Leo's gemini proxy

-- Connecting to thfr.info:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/plain

-- Response ended

-- Page fetched on Sat May 18 17:10:23 2024