X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/9fbe7cd69afa935c523e47d026d90158b1406bc4..795859dd991bf96637a5cdf3e46714e618c43881:/common.inc.plp diff --git a/common.inc.plp b/common.inc.plp index e5292ba..7788049 100644 --- a/common.inc.plp +++ b/common.inc.plp @@ -20,6 +20,20 @@ sub Alert { say "
$code" + . " after output!"; + } + Alert($html, $debug); + exit; +} + BEGIN { require Time::HiRes; our $Time = [Time::HiRes::gettimeofday()]; @@ -34,6 +48,8 @@ BEGIN { Alert("Fatal error: $html."); }; + push @INC, '.'; + # user request our $Dev = $ENV{HTTP_HOST} =~ /\bdev\./; our ($file) = $ENV{SCRIPT_FILENAME} =~ m{ ([^/]+) \.plp$ }x; @@ -70,7 +86,7 @@ sub stylesheet { return map { sprintf( '', - $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css?1.10", $_ + $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css?1.11", $_ ) } @avail; } @@ -105,7 +121,7 @@ sub Html { } # default fallbacks - $meta->{stylesheet} ||= [qw'light dark circus mono red terse']; + $meta->{stylesheet} ||= [qw( light dark circus mono red )]; $meta->{charset} ||= 'utf-8'; # convert options to arrays @@ -117,45 +133,51 @@ sub Html { unless $PLP::sentheaders; unshift @{ $meta->{raw} }, stylesheet($meta->{stylesheet}); + push @{ $meta->{raw} }, ( + '', + ); + # optional amends push @{ $meta->{raw} }, ( '', '', !$showkeys ? '' : $showkeys eq 'ghost' ? '' : (), - '', + '', ) if $meta->{keys}; - # leading output - say ''; - say ''; - say ''; - say ''; - say sprintf '', $_ - for $header{content_type}; - say sprintf '
beta
', join('; ', - 'position: fixed', - 'right: 1em', - 'opacity: .5', - 'border: 1ex solid red', - 'border-width: 1ex 0', - 'z-index: 1', - 'background: inherit', - ) if $Dev; + PLP_START { + # leading output + say ''; + say ''; + say ''; + say ''; + say sprintf '', $_ + for $header{content_type}; + say sprintf 'beta
', join('; ', + 'position: fixed', + 'right: 1em', + 'opacity: .5', + 'border: 1ex solid red', + 'border-width: 1ex 0', + 'z-index: 1', + 'background: inherit', + ) if $Dev; + }; # prepare trailing output PLP_END {