Skip Menu | will be shut down on March 1st, 2021.

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

Report information
The Basics
Id: 81530
Status: rejected
Priority: 0/
Queue: PDF-API2

Owner: Nobody in particular
Requestors: linux [...]

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

Subject: [PATCH} PDF::API2 don't destroy pdf object on stringify or save and saves but leave it to the user
Date: Thu, 29 Nov 2012 11:47:40 +0100
To: bug-PDF-API2 [...]
From: Sander Eikelenboom <linux [...]>
Download (untitled) / with headers
text/plain 354b
Hi, At the moment the following is not working: $pdf = PDF::API2->new(); ... my $filename = md5($pdf->stringify() . "pdf"); $pdf->saveas($filename); $pdf->end(); This is because stringify (and save and saveas) destroy the object. I think it would be better to leave this to the user and let him invoke $pdf->end(); Patch is attached. -- Sander
Download patch.diff
text/x-diff 894b

Message body is not shown because sender requested not to inline it.

Download (untitled) / with headers
text/plain 719b
Thank you for taking the time to write up a patch and send it in! Show quoted text
> I think it would be better to leave this to the user and let him > invoke $pdf->end();
If we were starting from scratch, I'd agree with you. However, if I were to implement this now, it would break quite a lot of existing code by not freeing up the memory that people are expecting to be freed (or at least accustomed to being freed). See the comment in PDF::API2::Basic::PDF::File's "release" method to see why this is important. However, I've made a note to clarify the documentation to the stringify method to say that it's destructive (I've been bit by this gotcha as well), and will consider other ways to implement something similar.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to