Blob
1 package GotMArc;2 use strict;3 use warnings;4 use v5.32;5 use Exporter;7 our @ISA = qw(Exporter);8 our @EXPORT_OK = qw($logo san mid2path initpage endpage);10 our $logo = <<'EOF';11 <a href="https://gameoftrees.org" target="_blank">12 <img srcset='/got-tiny.png, /got-tiny@2x.png 2x'13 src='/got-tiny.png'14 width='64' height='39'15 alt='"GOT", but the "O" is a cute, smiling sun' /></a>16 EOF18 sub san {19 my $str = shift;20 $str =~ s/&/\&/g;21 $str =~ s/</\</g;22 $str =~ s/>/\>/g;23 return $str;24 }26 sub mid2path {27 my $mid = shift;28 $mid =~ s,_,__,g;29 $mid =~ s,/,_,g;30 return $mid;31 }33 my $hdr = do {34 local $/ = undef;35 open my $fh, "<", "head.html"36 or die "can't open head.html: $!";37 <$fh>;38 };40 sub initpage {41 my ($fh, $title) = @_;42 say $fh $hdr =~ s/TITLE/$title/r;43 }45 my $foot = do {46 local $/ = undef;47 open my $fh, "<", "foot.html"48 or die "can't open foot.html: $!";49 <$fh>;50 };52 sub endpage {53 my $fh = shift;54 say $fh $foot;55 }57 1;