Re: Re: PDF::API2 suddenly broken
Alan Fry <ajf-n9G92GgND9yX/[email protected]> Mon, 16 Feb 2009 10:58:44 +0000
| Newsgroups | gmane.comp.lang.perl.modules.pdfapi2 |
|---|---|
| Message-ID | <[email protected]> |
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, but there may still be other bugs (affecting other Perl functions) lurking in the woodwork which have not yet come to light. 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 > >