Mailing List Archive

[Bug 7842] New: Perl 'indirect object notation' is deprecated, changing to the recommended syntax
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7842

Bug ID: 7842
Summary: Perl 'indirect object notation' is deprecated,
changing to the recommended syntax
Product: Spamassassin
Version: SVN Trunk (Latest Devel Version)
Hardware: PC
OS: FreeBSD
Status: NEW
Severity: normal
Priority: P2
Component: Libraries
Assignee: dev@spamassassin.apache.org
Reporter: Mark.Martinec@ijs.si
Target Milestone: Undefined

Created attachment 5710
--> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5710&action=edit
avoid indirect object notation (e.g. change: new IO::File() -> IO::File->new)

https://www.perl.com/article/announcing-perl-7/ :

At 'The Perl Conference in the Cloud' (2020-07), Sawyer X announced
that Perl has a new plan moving forward. Work on Perl 7 is already
underway, but it’s not going to be a huge change in code or syntax.
It’s Perl 5 with modern defaults and it sets the stage for bigger
changes later.

https://github.com/Perl/perl5/wiki/Perl7-FAQ


https://www.effectiveperlprogramming.com/2020/06/turn-off-indirect-object-notation/

Perl v5.32 adds a way to turn off a Perl feature that you shouldn’t
use anyway. You can still use this feature, but now there’s a way
to take it away from you. And, with the recent Perl 7 announcement,
we see why. Eventually Perl wants to get rid of indirect object
notation [...]


Most of the code in SpamAssassin use the recommended syntax of
method calls, but there are a couple of instances still left
there to use the undesired 'indirect object notation'.

To find these case a 'no feature qw(indirect)' was temporarily
inserted in *.pm and *.raw files right after 'use strict'.
The reported cases were rewritten, the patch is attached.

Unfortunately the 'no feature qw(indirect)' cannot stay in
the code, as it is only available with perl 5.32 and breaks
compatibility with earlier versions.

As this is a purely syntactic style change to match the prevalent
and recommended style of usage, the change does not introduce
any compatibility breakage with old versions of perl, and
tests show no problems - it seems the right thing to do
in view of the upcoming Perl 7.

I haven't touched t/*.t files, as these may require further work.
Also, with Perl7 the bareword filehandles will likely go away,
but this is a subject of another PR.

--
You are receiving this mail because:
You are the assignee for the bug.