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

Hey there after i updated my gentoo (linux) and perl was updated to version 5.12.4 recompiled the pdflib and so on

all perl depended stuff is completely updated

i got the following Error with a Web-application
] *** PDFlib context pointer (nil) is invalid ***, referer: http://loc +alhost/cgi-bin/atelier/my_fin_ab_2012/kwo_fin.cgi [Fri Aug 29 13:48:26 2014] [error] [client 127.0.0.1] pdflib_pl::PDF_o +pen_file could not open file '/var/www/localhost/htdocs/projectfin/pd +f_out/2014-08-28_r_21_.pdf'., referer: http://localhost/cgi-bin/ateli +er/my_fin_ab_2012/kwo_fin.cgi [Fri Aug 29 13:48:26 2014] [error] [client 127.0.0.1] [Fri Aug 29 13:4 +8:26 2014] kwo_fin.cgi: system perl /var/www/localhost/cgi-bin/atelie +r/my_fin_ab_2012/api-test7.pl 21 r failed: 65280 at /var/www/localhos +t/cgi-bin/atelier/my_fin_ab_2012/kwo_fin.cgi line 667., referer: http +://localhost/cgi-bin/atelier/my_fin_ab_2012/kwo_fin.cgi

so the kwo_fin.cgi line 667

sub kunde_rechnung_print7 { $mode='kunde_rechnung_auswahl'; $rsubnr = $query->param('RSubNr') || 0; $rnr = $query->param('RNr') || 0; $knr = $query->param('knr') || 0; admin_show(); admin_show(); my @args = ("perl","/var/www/localhost/cgi-bin/atelier/my_fin_ab_2 +012/api-test7.pl", $rnr, "r"); #line667 system(@args) == 0 or die "system @args failed: $?" }
calls a second perlscript in which i call
use PDF::Template; my $pdf = PDF::Template->new( filename => '/var/www/localhost/cgi-bin/atelier/my_fin_ab_2012/lib +/print_rech_tmpl.xml', ); my %my_params = .... ... $pdf->param(%my_params); #print "Content/type: application/pdf\n\n", $pdf->get_buffer; my $filename='/var/www/localhost/htdocs/projectfin/pdf_out/'.$Datum.'_ +'.$rema.'_'.$RNr.'_'.$firma.'_'.$name.'.pdf'; $pdf->write_file($filename); Cleanup();

so pdflib_pl::PDF_open_file could not open file

has anybody a idea where i could start to solve the problem

one more - Linux only - dance Achim

Replies are listed 'Best First'.
Re: PDFlib context pointer (nil) is invalid
by Achim (Initiate) on Aug 29, 2014 at 12:53 UTC
    Hey there running Version of pdflib = PDFlib-Lite-7.0.5p3/ so i started to test the pdflib example itself
    perl -W hello.pl *** PDFlib context pointer (nil) is invalid *** *** PDFlib context pointer (nil) is invalid *** *** PDFlib context pointer (nil) is invalid *** *** PDFlib context pointer (nil) is invalid *** Use of uninitialized value in die at hello.pl line 19. hello: PDFlib Exception occurred: Missing argument in printf at hello.pl line 44. Error:
    is there anything that changes in updated perl versions ?
    #!/usr/bin/perl # $Id: hello.pl,v 1.27 2006/10/01 19:55:11 rjs Exp $ # # PDFlib client: hello example in Perl # use pdflib_pl 7.0; $p = PDF_new(); eval { # This means we must check return values of load_font() etc. PDF_set_parameter($p, "errorpolicy", "return"); # This line is required to avoid problems on Japanese systems PDF_set_parameter($p, "hypertextencoding", "winansi"); if (PDF_begin_document($p, "hello.pdf", "") == -1) { die("Error: %s\n", PDF_get_errmsg($p)); } PDF_set_info($p, "Creator", "hello.pl"); PDF_set_info($p, "Author", "Thomas Merz"); PDF_set_info($p, "Title", "Hello world (Perl)!"); PDF_begin_page_ext($p, 595, 842, ""); $font = PDF_load_font($p, "Helvetica-Bold", "winansi", ""); if ($font == -1) { die("Error: %s\n", PDF_get_errmsg($p)); } PDF_setfont($p, $font, 24.0); PDF_set_text_pos($p, 50, 700); PDF_show($p, "Hello world!"); PDF_continue_text($p, "(says Perl)"); PDF_end_page_ext($p, ""); PDF_end_document($p, ""); }; if ($@) { printf("hello: PDFlib Exception occurred:\n"); printf(" $@\n"); exit; } PDF_delete($p);
    one more - Linux only - dance Achim

      I suggest you test the creation statement; I am not familiar with this module but the error messages suggest the problem is in the beginning.

      $p = PDF_new() or die "PDF creation failed\n";
      1 Peter 4:10