Skip Menu |

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

Report information
The Basics
Id: 120773
Status: rejected
Priority: 0/
Queue: CAM-PDF

People
Owner: Nobody in particular
Requestors: abrahmia [...] physics.rutgers.edu
Cc:
AdminCc:

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



Subject: CAM::PDF and Perl Tk
Date: Mon, 27 Mar 2017 21:22:55 +0000
To: "bug-CAM-PDF [...] rt.cpan.org" <bug-CAM-PDF [...] rt.cpan.org>
From: Abdelbaki Brahmia <abrahmia [...] physics.rutgers.edu>
Any reasons why this simple script does not run within a Perl Tk program. use CAM::PDF; my $pdf = CAM::PDF->new("file.pdf") ; <--THE PROBLEM IS HERE my $pages = $pdf->numPages(); #number of pages in the document HERE IS THE ERROR MESSAGE: Tk::Error: Can't call method "numPages" on an undefined value at ...
On Mon Mar 27 18:17:50 2017, abrahmia@physics.rutgers.edu wrote: Show quoted text
> Any reasons why this simple script does not run within a Perl Tk program. > > use CAM::PDF; > > my $pdf = CAM::PDF->new("file.pdf") ; <--THE PROBLEM IS HERE > > my $pages = $pdf->numPages(); #number of pages in the document > > > HERE IS THE ERROR MESSAGE: > Tk::Error: Can't call method "numPages" on an undefined value at ...
Whether it is running inside a Tk environment should make no difference. It is a matter of whether CAM::PDF is able to read the PDF in question. Is it possible to attach the PDF that fails? (Please note: I am not involved in maintaining CAM::PDF. I am just a lurker who uses it occasionally.)
You've forgotten to check if the $pdf variable is undef. If the PDF file is missing or unreadable, new() returns undef and sets an error flag.