raghuk has asked for the wisdom of the Perl Monks concerning the following question:

I've been trying to create multiple PDF files by looping through an array, it seems to be crapping out after the first iteration with a "Can't call method "new_obj" on unblessed reference at /usr/local/share/perl/5.18.2/PDF/API2/Page.pm line 268." Any assistance in this regard would be much appreciated, Thanks
  • Comment on PDF::API2::Simple - Can't call method "new_obj" on unblessed reference at /usr/local/share/perl/5.18.2/PDF/API2/Page.pm line 268.

Replies are listed 'Best First'.
Re: PDF::API2::Simple - Can't call method "new_obj" on unblessed reference at /usr/local/share/perl/5.18.2/PDF/API2/Page.pm line 268.
by NetWallah (Canon) on Nov 04, 2016 at 04:43 UTC
    It would help if you showed us the code - in particular, the calling sequence, and values of parameters passed.

    The area that is failing is:

    sub content { my ($self,$obj,$dir) = @_; if(defined($dir) && $dir>0) { $self->precontent($obj); } else { $self->addcontent($obj); } $self->{' apipdf'}->new_obj($obj) unless($obj->is_obj($self->{' ap +ipdf'}));
    and it appears that "$self->{' apipdf'}" is not defined.
    Has that been setup properly , perhaps by calling the "coerce" method ?

            ...it is unhealthy to remain near things that are in the process of blowing up.     man page for WARP, by Larry Wall