SA Bugzilla – Bug 7842
Perl 'indirect object notation' is deprecated, changing to the recommended syntax
Last modified: 2021-10-17 07:11:58 UTC
Created attachment 5710 [details] 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.
trunk: $ svn ci -m "Bug 7842: Perl 'indirect object notation' is deprecated, changing to the recommended syntax" Sending lib/Mail/SpamAssassin/Bayes.pm Sending lib/Mail/SpamAssassin/Locker/Flock.pm Sending lib/Mail/SpamAssassin/Locker/UnixNFSSafe.pm Sending lib/Mail/SpamAssassin/NetSet.pm Sending lib/Mail/SpamAssassin/Plugin/OLEVBMacro.pm Sending lib/Mail/SpamAssassin/SQLBasedAddrList.pm Sending lib/Mail/SpamAssassin/Util.pm Sending lib/Mail/SpamAssassin.pm Sending sa-check_spamd.raw Sending sa-compile.raw Sending sa-learn.raw Sending sa-update.raw Sending spamassassin.raw Sending spamd/spamd.raw Transmitting file data ..............done Committing transaction... Committed revision 1880113.
Created attachment 5716 [details] more cases of indirect object notation - in supporting code $ svn ci -m "Bug 7842: Perl 'indirect object notation' is deprecated, changing to the recommended syntax - more cases (in supporting code)" Sending build/old/sha1sum.pl Sending build/sha256sum.pl Sending build/sha512sum.pl Sending lib/Mail/SpamAssassin/ArchiveIterator.pm Sending lib/Mail/SpamAssassin/BayesStore/PgSQL.pm Sending lib/Mail/SpamAssassin/PerMsgLearner.pm Sending lib/Mail/SpamAssassin/PerMsgStatus.pm Sending masses/corpora/mass-find-nonspam Sending masses/mass-check Sending spamd-apache2/lib/Mail/SpamAssassin/Spamd/Config.pm Sending t/rule_names.t Sending t/trust_path.t Sending t.rules/run Sending tools/split_corpora Transmitting file data ..............done Committing transaction... Committed revision 1880828.
Objective accomplished (except possibly in tests), closing.
Seems PDFInfo had some accidental leftovers in Revision 1893514 Fixed Sending trunk/lib/Mail/SpamAssassin/Plugin/PDFInfo.pm Transmitting file data .done Committing transaction... Committed revision 1894307.