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