Permalink
Browse files

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

  • Loading branch information...
ctfliblime committed Aug 11, 2011
1 parent f8ef103 commit faf390eb9e02c67595bc5d0797a018c424a48581
Showing with 12 additions and 1 deletion.
  1. +12 −1 C4/Labels/PDF.pm
View
@@ -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,19 +39,28 @@ 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;
}
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.