in reply to Re: Re: Avoiding race conditions
in thread Avoiding race conditions
Yeah, I would experiment with other POD::*, or a *2pdf utility. POD doesn't do pagebreaks (as far as I have ever read), but the PDF module/utility will give you a way to define the page dimensions.. so it should add pagebreaks.
No, sadly the user is not logged in. This isn't mod_perl, just straight CGI, so I could use the PID I suppose. hmm. Other than a cronjob, I have no idea how to automatically unlink the file, since the CGI creating the PDF will end presumably long before the PDF is completely downloaded.
I do this:
my $out = pod2pdf(@args); print "Content-Type: application/pdf\n"; print "Content-Disposition: attachment; filename=$username.tasks.pdf\n +\n"; unlink "./pod/$username.tasks.$$.pod"; binmode(STDOUT); return print $out;
Of course, YMMV depending on the module you use. I think I had hacked POD::Pdf to return the Pdf data instead of just writing it to the file. I don't recall. But, otherwise you could just read the file in and print it:
my $out; { local $/ = undef; open(PDF, "$file") or die "foo $!"; $out = <PDF>; close PDF; }
Or whatever fits your fancy.
Cheers,
KM
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (4) Avoiding race conditions
by swiftone (Curate) on Apr 24, 2001 at 22:38 UTC |