You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@spamassassin.apache.org on 2020/07/21 18:36:24 UTC

[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.

[Bug 7842] Perl 'indirect object notation' is deprecated, changing to the recommended syntax

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7842

--- Comment #2 from Mark Martinec <Ma...@ijs.si> ---
Created attachment 5716
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5716&action=edit
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.

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

[Bug 7842] Perl 'indirect object notation' is deprecated, changing to the recommended syntax

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7842

Mark Martinec <Ma...@ijs.si> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Mark Martinec <Ma...@ijs.si> ---
Objective accomplished (except possibly in tests), closing.

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

[Bug 7842] Perl 'indirect object notation' is deprecated, changing to the recommended syntax

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7842

--- Comment #1 from Mark Martinec <Ma...@ijs.si> ---
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.

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

[Bug 7842] Perl 'indirect object notation' is deprecated, changing to the recommended syntax

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7842

Henrik Krohns <ap...@hege.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |apache@hege.li

--- Comment #4 from Henrik Krohns <ap...@hege.li> ---
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.

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

[Bug 7842] Perl 'indirect object notation' is deprecated, changing to the recommended syntax

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7842

Mark Martinec <Ma...@ijs.si> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|Undefined                   |4.0.0

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