Validate $num and $gen arguments to read_objnum
Steve Simms
7 years ago
156 | 156 | |
157 | 157 | my $readDebug = 0; |
158 | 158 | |
159 | use Carp; | |
159 | 160 | use IO::File; |
160 | 161 | |
161 | 162 | # Now for the basic PDF types |
696 | 697 | |
697 | 698 | sub read_objnum { |
698 | 699 | my ($self, $num, $gen, %opts) = @_; |
700 | croak 'Undefined object number in call to read_objnum($num, $gen)' unless defined $num; | |
701 | croak 'Undefined object generation in call to read_objnum($num, $gen)' unless defined $gen; | |
702 | croak "Invalid object number '$num' in call to read_objnum" unless $num =~ /^[0-9]+$/; | |
703 | croak "Invalid object generation '$gen' in call to read_objnum" unless $gen =~ /^[0-9]+$/; | |
699 | 704 | |
700 | 705 | my $object_location = $self->locate_obj($num, $gen) || return; |
701 | 706 | my $object; |