Re: PDF::API2 suddenly broken
"jeffchimene" <jeff-CZn2F6e2yomE/[email protected]> Mon, 16 Feb 2009 18:51:33 -0000
| Newsgroups | gmane.comp.lang.perl.modules.pdfapi2 |
|---|---|
| Message-ID | <[email protected]> |
--- In [email protected], Alan Fry <ajf@...> wrote: > > > On 15 Feb 2009, at 16:16, jeffchimene wrote: > > > --- In [email protected], Alan Fry <ajf@> > > wrote: > > > > > > My trusty PDF::API2 which has worked perfectly for years has > > suddenly > > > ceased to function. This minimal script: > > > > > > $page = $pdf_out->page; > > > $page->mediabox(595, 842); > > > $page->gfx; > > > #$xo = $pdf_out->importPageIntoForm($pdf_in, 1); > > > #$gfx->formimage($xo, 0, 0, 1); > > > > > > trips up at the line '$page->gfx' with the error 'Undefined > > subroutine > > > &Compress::Zlib::compress called at /Library/Perl/5.8.8/PDF/API2/ > > > Content.pm line 102.' > > > > > > But 'Compress' is there and 'Zlib.pm' in that folder; and Zlib has a > > > subroutine named 'compress'. So what can be possibly be wrong > > here? "/ > > > Library/Perl/5.8.8/' is in @INC, so "/Library/Perl/5.8.8/Compress/" > > > should be found, should it not? > > > > > > If the next line is included ($xo = etc.) the error message changes > > > to: 'Can't call method "infilt" on an undefined value at /Library/ > > Perl/ > > > 5.8.8/PDF/API2/Util.pm line 667.' > > > > > > The only thing that has changed in recent days is a security update > > > (Mac OSX 10.5.6 -- Intel MacPro) which I think was mostly to do > > with a > > > loophole in Safari -- and I doubt that had anything to do with > > > "Compress::Zlib". > > > > > > I would be most grateful for any suggestions what to do next, > > > > > > Alan Fry > > > > > > > Well, something has changed. Can you post the entire script? Perhaps > > the script setup needs to change. > > Sure: > > #!/usr/bin/perl > #---------------------------------- Modules > ------------------------------------- > use PDF::API2; > use File::Basename; > #----------------------------------- Files > -------------------------------------- > $file_in = $ARGV[0]; > exit unless -f $file_in; > my($base, $path, $type) = fileparse($file_in, qr{\.pdf}); > if (!$type){print "Not a PDF file -- quitting\n"; exit}; > #------------------------------------ Main > -------------------------------------- > my $pdf_in = PDF::API2->open($file_in) or die "$!\n"; > my $pdf_out = PDF::API2->new or die "$!\n"; > my $page = $pdf_out->page; > $page->mediabox(595, 842); > my $gfx = $page->gfx; > my $xo = $pdf_out->importPageIntoForm($pdf_in, 1); > $gfx->formimage($xo, 0, 0, 1); > > $pdf_out->saveas($path.$base."page1.pdf"); > $pdf_in->end; > $pdf_out->end; > > However since writing I have found messages on Mac OS sites indicating > that Perl has been severely broken by Apple's recent 'Security Update'. > > In my case specifically, reinstalling Compress::Zlib and Scalar::Util > seem to have fixed the immediate problem with PDF::API2, Good. There isn't much to say about this prog. > but there may > still be other bugs (affecting other Perl functions) lurking in the > woodwork which have not yet come to light. I am certainly not an expert on the following, so take it with a grain of salt. It might be interesting to install yacsmoke and run it on PDF::API2. The downsise is that there's only one Test:: module for PDF::API2 in the Manifest, and it's just a "use" test. So, any smoke test is probably pretty useless. I should think that when you reinstalled Compress::Zlib, you also triggered a reinstallation of all its dependencies. A wild-ass guess would suggest that Apple broke library bindings, which affected stuff like Compress::* (upon which Compress::Zlib depends. See http://cpansearch.perl.org/src/PMQS/Compress-Zlib-2.015/t/000prereq.t) One thing about PDF::API2 is that it does not have a lot of dependencies (the makefile only lists Compress::Zlib). So, from the "... lurking in the woodwork ..." perspective, you're probably in good shape. OTOH, if you have other Perl modules, it might be worth running the "make test" phase on them. > > I must apologise for raising what turns out to be an off-topic issue > in so far as the matter relates solely to Mac OS X 10.5.x and not > directly to PDF::API2. However I hope it will be helpful to any other > Mac users who see this mailing list. > > Many thanks indeed for your prompt reply which is very much > appreciated. > > Regards, > > Alan Fry > > > > > > >