Skip to content

Commit

Permalink
Validate the new() in pdfpage
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Dec 19, 2024
1 parent 4328e60 commit 93ea261
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions gedcom
Original file line number Diff line number Diff line change
Expand Up @@ -14028,15 +14028,20 @@ use warnings;

# Add text to a page on a PDF document

our $pixelsperline = 16; # point size 12
our $page_number = 1;
our $pixelsperline;
our $page_number;

BEGIN {
$pixelsperline = 16; # point size 12
$page_number = 0;
}

sub new
{
my $class = shift;
my $pdf = shift; # PDF::API2 object
my ($class, $pdf) = @_;

$pixelsperline = 16;
# Validate input
die 'Invalid PDF::API2 object' unless($pdf->can('page'));

# Return the blessed object
return bless { y => 750, page => $pdf->page(), page_number => $page_number++ }, $class;
Expand All @@ -14049,6 +14054,7 @@ sub newline
$self->{'y'} -= $pixelsperline;

if($self->{'y'} <= 10) {
# Log call stack for debugging
my $i = 0;
while((my @call_details = (caller($i++)))) {
print STDERR "\t", $call_details[1], ':', $call_details[2], ' calling function ', $call_details[3], "\n";
Expand Down Expand Up @@ -14080,6 +14086,7 @@ sub y

if($y) {
if($y <= 10) {
# Log call stack for debugging
my $i = 0;
while((my @call_details = (caller($i++)))) {
print STDERR "\t", $call_details[1], ':', $call_details[2], ' calling function ', $call_details[3], "\n";
Expand Down

0 comments on commit 93ea261

Please sign in to comment.