This is part of the YARRG website. YARRG is a tool and website
for assisting players of Yohoho Puzzle Pirates.
Copyright (C) 2009 Ian Jackson
Copyright (C) 2009 Clare Boothby
YARRG's client code etc. is covered by the ordinary GNU GPL (v3 or later).
The YARRG website is covered by the GNU Affero GPL v3 or later, which
basically means that every installation of the website will let you
download the source.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
are used without permission. This program is not endorsed or
sponsored by Three Rings.
This Mason autohandler contains the doctype, charset and
copyright message.
%doc>
use CommodsWeb;
my $printable= printable($m);
if ($printable =~ m/^pdf|^ps/) {
my $output;
my $got= $m->call_self(\$output);
if ($got) {
my @htargs= qw(htmldoc --continuous --gray --size 210x279mm
--left 1cm --right 1cm);
$printable =~ m/^[a-z]+/;
push @htargs, '-t',$&;
if ($printable =~ m/2$/) {
push @htargs, qw(--nup 2);
}
push @htargs, qw(-);
my $tmpfile= IO::File::new_tmpfile();
print $tmpfile $output or die $!;
$tmpfile->flush() or die $!;
seek $tmpfile,0,0 or die $!;
my $htmldoc= open HTMLDOC, "-|";
defined $htmldoc or die $!;
if (!$htmldoc) {
eval {
$ENV{'HTMLDOC_NOCGI'}=1;
open STDIN, 'content_type($printable eq 'pdf' ? 'application/pdf' :
'application/postscript');
while ($read= read HTMLDOC,$data,32768) { print $data; }
defined $read or die $!;
$?=0; $!=0; close HTMLDOC or die "$! $? $output ";
return;
}
}
set_ctype_utf8();
$r->content_type('text/html; charset=UTF-8');
%perl>
% $m->call_next();