On Wed, Oct 22, 2008 at 3:29 PM, Jesse Sheidlower <[EMAIL PROTECTED]> wrote:
> On Wed, Oct 22, 2008 at 08:46:25PM +0100, Oliver Gorwits wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Kirby Krueger wrote:
>> > And in case you want PNG or PDF output, you'll need just a few
>> > lines...
>>
>> We have a system doing PDF on the fly from Template::Toolkit, but
>> you have to go via LaTeX - it's not so bad, do not be put off!
>>
>> http://www.catalystframework.org/calendar/2006/12
>
> Was the hack required in that Advent entry, necessitated by a
> bug in the standalone server, ever fixed? If so, perhaps we
> should re-edit this entry to remove that entire section. Right
> now it's the sort of thing a lot of people would look at and
> then run away from....
>
> Jesse Sheidlower
>
We used that entry as guidance to do PDF generation via LaTeX. Instead
of hacking at system, we patched Catalyst::Engine::HTTP (see
attachment). It has worked for us for awhile now.
For what it's worth, LaTeX worked out really well for us. It gives you
the control/expressiveness it sounds like the OP needs, without having
to learn the guts of PDF generation.
Regards,
Nate Green
sagrader.com
> _______________________________________________
> List: [email protected]
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/
>
Index: lib/perl5/Catalyst/Engine/HTTP.pm
===================================================================
--- lib/perl5/Catalyst/Engine/HTTP.pm (revision 2102)
+++ lib/perl5/Catalyst/Engine/HTTP.pm (working copy)
@@ -11,6 +11,7 @@
use Socket;
use IO::Socket::INET ();
use IO::Select ();
+use POSIX ":sys_wait_h";
# For PAR
require Catalyst::Engine::HTTP::Restarter;
@@ -189,7 +190,6 @@
}
my $restart = 0;
- local $SIG{CHLD} = 'IGNORE';
my $allowed = $options->{allowed} || { '127.0.0.1' => '255.255.255.255' };
my $addr = $host ? inet_aton($host) : INADDR_ANY;
@@ -278,8 +278,22 @@
if ( $options->{fork} ) {
if ( $pid = fork ) {
DEBUG && warn "Forked child $pid\n";
+ # Wait for child to complete its fork
+ my $kid;
+ do {
+ $kid = waitpid($pid, WNOHANG);
+ } until $kid > 0;
next;
}
+ else {
+ # child forks again
+ # double-fork avoids defining SIG{CHLD} in main process,
+ # which causes system() and backticks to return incorrect status
+ if ($pid = fork) {
+ die "Fork failed: $!" if $pid < 0;
+ exit;
+ }
+ }
}
$self->_handler( $class, $port, $method, $uri, $protocol );
@@ -324,7 +338,6 @@
DEBUG && warn "Shutting down\n";
if ($restart) {
- $SIG{CHLD} = 'DEFAULT';
wait;
### if the standalone server was invoked with perl -I .. we will loose
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/