Created attachment 9161 [details] [review] Bug 7952 - PDF::Reuse under plack writes to console STDOUT instead to browser Without name option to prFile, PDF::Reuse opens '-' file which is real console STDOUT on plack so pdf file gets emited to terminal instead of sending it to browser. This change creates temporary file using File::Temp, pass it to PDF::Reuse and then reads it back and prints it out for plack (or CGI) to pick up. Test secenario: 1. Home › Tools › Patron Card Creator › Manage Card Batches 2. select batch checkbox and click Export 3. select template and click Export 4. click on pdf file to download it
QA comment: * there is an unconditional warn added: + warn "## Name [$opts{Name}] $fh"; please remove it of write $ENV{DEBUG} and warn "## Name [$opts{Name}] $fh";
Created attachment 9893 [details] [review] Bug 7952 - PDF::Reuse under plack writes to console STDOUT instead to browser Without name option to prFile, PDF::Reuse opens '-' file which is real console STDOUT on plack so pdf file gets emited to terminal instead of sending it to browser. This change creates temporary file using File::Temp, pass it to PDF::Reuse and then reads it back and prints it out for plack (or CGI) to pick up. DEBUG=1 it will debugging output Test secenario: 1. Home › Tools › Patron Card Creator › Manage Card Batches 2. select batch checkbox and click Export 3. select template and click Export 4. click on pdf file to download it
Created attachment 10042 [details] [review] [Signed-off] Bug 7952 - PDF::Reuse under plack writes to console STDOUT instead to browser Without name option to prFile, PDF::Reuse opens '-' file which is real console STDOUT on plack so pdf file gets emited to terminal instead of sending it to browser. This change creates temporary file using File::Temp, pass it to PDF::Reuse and then reads it back and prints it out for plack (or CGI) to pick up. DEBUG=1 it will debugging output Test secenario: 1. Home › Tools › Patron Card Creator › Manage Card Batches 2. select batch checkbox and click Export 3. select template and click Export 4. click on pdf file to download it Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
QA comment: * sorry about that, but there's an unconditionnal warn: + warn "## Name [$opts{Name}] $fh"; so, failed QA until you've removed it (or $ENV{DEBUG} &&...) Other than this, tiny patch, will pass QA
Created attachment 10090 [details] [review] Bug 7952 - PDF::Reuse under plack writes to console STDOUT instead to browser Without name option to prFile, PDF::Reuse opens '-' file which is real console STDOUT on plack so pdf file gets emited to terminal instead of sending it to browser. This change creates temporary file using File::Temp, pass it to PDF::Reuse and then reads it back and prints it out for plack (or CGI) to pick up. Test secenario: 1. Home › Tools › Patron Card Creator › Manage Card Batches 2. select batch checkbox and click Export 3. select template and click Export 4. click on pdf file to download it
Sorry about that. It seems that I wanted to add $ENV{DEBUG} around that warn (and even included it in commit message) but never changed code. On second look, I think it's not really useful to anyone expect me while development so it's removed -- less cruft, more kittens!
Created attachment 10126 [details] [review] Bug 7952 - PDF::Reuse under plack writes to console STDOUT instead to browser Without name option to prFile, PDF::Reuse opens '-' file which is real console STDOUT on plack so pdf file gets emited to terminal instead of sending it to browser. This change creates temporary file using File::Temp, pass it to PDF::Reuse and then reads it back and prints it out for plack (or CGI) to pick up. Test secenario: 1. Home › Tools › Patron Card Creator › Manage Card Batches 2. select batch checkbox and click Export 3. select template and click Export 4. click on pdf file to download it Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
QA comment: this time it's OK, nothing to object !
Patch pushed (I haven't tested it, I have no patron cards on y test database)
This now needs a follow up to correct the behaviour in t/Creators.t
Created attachment 10278 [details] [review] Bug 7952 - followup to fix t/Creators.t Since we are now using temporary file, we are creating test.pdf at end of test and checking if it exists and have non-zero size.
Trivial follow-up, make test working, will signoff/pass QA/push in one go
Pushed both the original and follow up to 3.8.x, will be in 3.8.2