<:
+use 5.014;
use utf8;
-use strict;
use warnings;
no warnings 'qw'; # you know what you doing
no warnings 'uninitialized'; # save some useless checks for more legible code
$PLP::ERROR = sub {
my ($text, $html) = @_;
print '<p class="error"><strong>Fatal error</strong>: '.$html."</p>\n\n";
+ warn $text;
};
+BEGIN {
+ require Time::HiRes;
+ our $Time = [Time::HiRes::gettimeofday];
+}
+
our $style;
our $showkeys = !exists $get{keys} ? undef :
($get{keys} ne '0' && ($get{keys} || 'always'));
return join "\n", map { sprintf(
'<link rel="%s" type="text/css" media="all" href="%s" title="%s">',
- $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css?1.7", $_
+ $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css?1.9", $_
) } @_;
}
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="/clip.png">
EOT
- print $_, "\n" for $meta->{stylesheet} || ();
- print $_, "\n" for $meta->{raw} || ();
- print qq{</head>\n\n<body id="$file">\n};
+ say for $meta->{stylesheet} || ();
+ say for $meta->{raw} || ();
+ say qq{</head>\n\n<body id="$file">};
# dev indicator
+ my $Dev = $ENV{HTTP_HOST} =~ /\bdev\./;
printf '<p style="%s">beta</p>', join('; ',
'position: fixed',
'right: 1em',
'border-width: 1ex 0',
'z-index: 1',
'background: inherit',
- ) if $ENV{HTTP_HOST} =~ /\bdev\./;
+ ) if $Dev;
# prepare trailing output
PLP_END {
<p class="footer">
<a href="/" rel="start">sheet.shiar.nl</a>/$file.<a href="/source/$file.plp"
rel="source" title="Written in Perl">plp</a>
- <a href="http://git.shiar.nl/sheet.git/history/HEAD:/$file.plp"
- rel="vcs-git" title="Git repository">v$meta->{version}</a>
+ version <a href="http://git.shiar.nl/sheet.git/history/HEAD:/$file.plp"
+ rel="vcs-git" title="Git repository">$meta->{version}</a>
created by <a href="http://shiar.nl/" rel="author">Shiar</a> •
<a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="license copyright"
title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
-</p>
-
-</html>
EOT
+ say sprintf '• %.3fs', Time::HiRes::tv_interval($Time) if $Dev;
+ say '</p>';
+ say '';
+ say '</html>';
};
}