C-Duv / sysadmin-scripts

Collection of scripts used for system administration.
GNU General Public License v3.0
9 stars 4 forks source link

[duplicityBackup] Perl 5.20 gives a "Smartmatch is experimental" warning #13

Closed C-Duv closed 9 years ago

C-Duv commented 9 years ago

When using Perl v5.20, scripts outputs the following warning:

Smartmatch is experimental at duplicityBackup line 1359.

Script works fine but the warning being outputted can be annoying.

C-Duv commented 9 years ago

This is because of the smartmatch (~~) being declared experimental feature since Perl 5.18

According to A little nicer way to use smartmatch on perl 5.18, a simple fix is:

no if $] >= 5.017011, warnings => 'experimental::smartmatch';

Or, better, the experimental CPAN module from Leon Timmermans that allows:

use experimental 'smartmatch';

Third fix is to use match::smart CPAN module from Toby Inkster that implements the smartmatch operator.