Skip Menu |

This queue is for tickets about the CAM-PDF CPAN distribution.

Report information
The Basics
Id: 50173
Status: open
Priority: 0/
Queue: CAM-PDF

People
Owner: Nobody in particular
Requestors: Tim.Mooney [...] ndsu.edu
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: uninitialized value warnings in Text/PDF/Filter.pm
Date: Fri, 2 Oct 2009 14:17:24 -0500 (CDT)
To: bug-CAM-PDF [...] rt.cpan.org
From: Tim Mooney <Tim.Mooney [...] ndsu.edu>
Hi! I've installed CAM::PDF 1.52 after installing Crypt::RC4 2.02 Font::TTF 0.45 Text::PDF 0.29a All were installed for perl 5.8.8 on x86_64-sun-solaris2.10. I'm trying to munge some text content in some PDF reports. Whether I use the provided changepagestring.pl or use the underlying calls in my own script, I get a lot of uninitialized value warnings coming out of Text::PDF::Filter.pm: /local/bin/perl -w changepagestring.pl old-report.pdf \ 'Daily Summary' 'My New Title' new-report.pdf Use of uninitialized value in string ne at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 139. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Use of uninitialized value in subtraction (-) at /local/lib/perl5/site_perl/5.8.8/Text/PDF/Filter.pm line 167. Plus a couple hundred more of the uninit value in subtraction warnings. The first warning happens here: sub infilt { my ($self, $str, $isend) = @_; my ($res, $i, $j, @c, $b, $num); if ($self->{'incache'} ne "") # <---------------------- { $str = $self->{'incache'} . $str; $self->{'incache'} = ""; } and clearly means that $self->{'incache'} is completely undefined. The rest of the warnings happen later in the same routine: for ($j = 0; $j < 5; $j++) { $b *= 85; $b += $c[$j] - 33; } $res .= substr(pack("N", $b), 0, 4 - $num); # <----------- Any thoughts on where the ultimate problem is? It could be - a problem with the PDFs themselves. They're generated on the fly from our backup system's reporting facility. The reporting engine is all written in Java, but I haven't yet been able to track down what library routines are actually being called to generate the PDFs, so I have no idea what the provenance of the PDF generation code is. - a problem in Text::PDF -- it should most likely be doing a little more checking to make certain that its assumptions about what will be defined are true. - a problem in CAM::PDF -- it's doing something it shouldn't be when calling Text::PDF. Despite having lots of perl experience going back to perl 4.x, I've never had to use the perl debugger and most of the bugs I've had to deal with over the years have been in code I wrote. ;-) Trying to track down a problem in a huge call chain of perl modules has me wondering where to start. Note that I can provide example 1-page PDFs that illustrate the problem if you're interested in taking a look at the PDF. I'm currently exploring what PDF validation/lint options are available, to see if I can turn up any obvious problems with the PDFs themselves, but so far I haven't found much that's freely available. Thanks, Tim -- Tim Mooney Tim.Mooney@ndsu.edu Enterprise Computing & Infrastructure 701-231-1076 (Voice) Room 242-J6, IACC Building 701-231-8541 (Fax) North Dakota State University, Fargo, ND 58105-5164
Tim, This sounds really familiar (like, I solved this exact problem before) but I have not been able to find records of the previous solution. I vaguely recall that the problem was a broken install of Text::PDF, but I'm not sure. I'll search a little more... Chris
Subject: Re: [rt.cpan.org #50173] uninitialized value warnings in Text/PDF/Filter.pm
Date: Thu, 8 Oct 2009 20:35:11 -0500
To: bug-CAM-PDF [...] rt.cpan.org
From: Chris Dolan <chris [...] chrisdolan.net>
OK, I found a little bit more info. Your PDF is using ASCII-85 encoding to compress some of the content. That's a pretty rarely-used encoding. I see that Text::PDF::ASCII85Decode has the following line (line 91 of Text/PDF/Filter.pm) # no warnings qw(uninitialized); Clearly, someone once thought that it was worthwhile to unsilence those warnings. Looking at http://backpan.perl.org/authors/id/M/MH/MHOSKEN/ I can determine that those lines were commented out in Text::PDF 0.20 in June 2002. That was the last change that was ever made to Text::PDF::Filter. I think the problem is that most Perl programs today are invoked with - w and Text::PDF is not compatible with that. So, my advice is to hack your local copy of Text::PDF::Filter and uncomment the "no warnings" lines.