Post without Account — your post will be reviewed, and if appropriate, posted under Anonymous. You can also use this link to report any problems registering or logging in.

[RT 123722] split deprecate

  • 1 Replies
  • 988 Views
*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 412
    • View Profile
[RT 123722] split deprecate
« December 25, 2017, 07:32:37 PM »
 PhilterPaper commented on Nov 23

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:

Quote
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 on Nov 23

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.

*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 412
    • View Profile
Re: [RT 123722] split deprecate
« Reply #1: June 28, 2018, 02:56:59 PM »
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:

Code: [Select]
my $space_count = scalar split /\s/, $text;
becomes:

Code: [Select]
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

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'