Closed paultcochrane closed 8 years ago
It looks like the if/elsif is parsing two different types of file. In the first case, the file will get closed, but in the second, it doesn't. Moving the close outside of the if seems like the right step, so I'll do that after merging this PR. Thanks for bringing it up.
This PR updates the code to use the three argument form of
open
and replaces bareword filehandles with scoped lexical variables. These issues were found byperlcritic
running at the default severity level. The reason why both issues are handled in the one PR is that the changes often affect the same lines of code, hence if put into separate PRs they would cause conflicts.This PR is submitted in the hope that it is helpful. If it can be improved upon or needs to be updated, please just let me know and I'll update as required and resubmit.
I noticed a potential issue in
lib/PDF/API2/Resource/Font/Postscript.pm
at line 118 while preparing this PR: the filehandle is closed on this line, however it is also used in the followingelsif
block. Unfortunately, I'm not that familiar with the code, so I'm not 100% sure what the correct code would be, however it looks like it would be best to close the filehandle outside theif
-elsif
-else
blocks so that seeks and reads being called in theelsif
block run on an opened filehandle. Just thought you'd like to know!