PhilterPaper / Perl-PDF-Builder

Extended version of the popular PDF::API2 Perl-based PDF library for creating, reading, and modifying PDF documents
https://www.catskilltech.com/FreeSW/product/PDF%2DBuilder/title/PDF%3A%3ABuilder/freeSW_full
Other
6 stars 7 forks source link

[RT 123722] split deprecate #82

Closed PhilterPaper closed 6 years ago

PhilterPaper commented 6 years ago

Thu Nov 23 11:21:52 2017 denni.pat [...] gmail.com - Ticket created

version PDF-API2-2.033 http://search.cpan.org/~ssimms/PDF-API2-2.033/ perl version 5.8.9 Unix OS

Hi, if i use PDF:API2:Content.pm i receive:

Use of implicit split to @_ is deprecated at PDF/API2/Content.pm line 1876.

Use of implicit split to @_ is deprecated at PDF/API2/Content.pm line 1932.

Thanks. Denis

PhilterPaper commented 6 years ago

As Content.pm was rewritten for PDF::Builder, neither of these lines still exist. The complaint appears to involve scalar split ... sequences, which may upset some Perl versions. The fix may be as simple as putting () around the split command, though I haven't tried it. By the way, Perl 5.8 is quite ancient, and should be upgraded to at least 5.26.

As this error apparently does not affect PDF::Builder, I''ll close it.

PhilterPaper commented 6 years ago

Sat Jun 02 17:37:02 2018 steve [...] deefs.net - Correspondence added

Hi Denis,

Thanks for the bug report. It looks like that warning only shows up in very old versions of Perl (not since 5.12.0, which was released in 2010).

The recommended workaround is pretty ugly... The original:

my $space_count = scalar split /\s/, $text;

becomes:

my $space_count = () = $text =~ /\s/g;

So, I just spent a while pondering how many old versions to support, and decided on six years and a bit, which I think is between double and triple Perl itself, and should cover most LTS server release schedules.

As a note, you must be running perl with the "-w" flag, since deprecation warnings are explicitly turned off for that module otherwise (see "What's wrong with -w" in perldoc warnings).

If you're stuck on 5.8.9 (released in 2008) and can't upgrade, you can get the warnings to disappear by removing the -w flag or by using the suggested replacement code above. I'd suggest looking into using Perlbrew or plenv as well (which let you install a newer version of Perl locally without needing admin privileges), so that you can get the many performance and security updates that have been added in the past ten years.

-- Steve

On Thu Nov 23 11:21:52 2017, denni.pat@gmail.com wrote: Show quoted text # Sat Jun 02 17:37:02 2018 The RT System itself - Status changed from 'new' to 'open' # Sat Jun 02 17:37:03 2018 steve [...] deefs.net - Status changed from 'open' to 'resolved'