Skip to content
Browse files

[#16893161] (fixup) PDF::Reuse writes to wrong STDOUT under Plack

  • Loading branch information...
1 parent f8ef103 commit faf390eb9e02c67595bc5d0797a018c424a48581 @ctfliblime ctfliblime committed
Showing with 12 additions and 1 deletion.
  1. +12 −1 C4/Labels/PDF.pm
View
13 C4/Labels/PDF.pm
@@ -21,6 +21,8 @@ use strict;
use warnings;
use PDF::Reuse;
use PDF::Reuse::Barcode;
+use IO::All;
+use File::Temp;
BEGIN {
use version; our $VERSION = qv('1.0.0_1');
@@ -37,12 +39,18 @@ sub new {
my $type = ref($invocant) || $invocant;
my %opts = @_;
my $self = {};
+
+ my $tmpfile = File::Temp->new( UNLINK => 0, SUFFIX => '.pdf' );
+ $self->{filename} = "$tmpfile";
+ close $tmpfile;
+ $opts{Name} = $self->{filename};
+
_InitVars() if ($opts{InitVars} == 0);
_InitVars($opts{InitVars}) if ($opts{InitVars} > 0);
delete($opts{InitVars});
prDocDir($opts{'DocDir'}) if $opts{'DocDir'};
delete($opts{'DocDir'});
- prFile(%opts);
+ prFile(\%opts);
bless ($self, $type);
return $self;
}
@@ -50,6 +58,9 @@ sub new {
sub End {
my $self = shift;
prEnd();
+ my $io = io $self->{filename};
+ print $io->all;
+ $io->unlink;
}
sub Add {

0 comments on commit faf390e

Please sign in to comment.
Something went wrong with that request. Please try again.