[Koha-devel] smartmatch unsafe in current perl

Colin Campbell colin.campbell at ptfs-europe.com
Thu Jan 2 15:29:35 CET 2014


Happy new year folks.

People should be aware of this in the perldelta for 5.18:


> Smartmatch family of features are now experimental
> Smart match, added in v5.10.0 and significantly revised in v5.10.1,
> has
> been a regular point of complaint. Although there are a number of ways in
> which it is useful, it has also proven problematic and confusing for both
> users and implementors of Perl. There have been a number
> of proposals on
> how to best address the problem. It is clear that
> smartmatch is almost ecrtainly either going to change or go away in
> the future. Relying on its current behavior is not recommended.
>
> Warnings will now be issued when the parser sees "~~", "given", or "when".
> To disable these warnings, you can add this line to the appropriate
> scope:
>
> no if $] >= 5.018, warnings => "experimental::smartmatch";
>
> Consider, though, replacing the use of these features, as they may
> change behavior again before becoming stable.

Compiling and running the current master does generate a number of
warnings triggered by these features. It looks as if it would be a
wise move to avoid these features in new code. I'll try and look at
those occurences and see if they can be addressed by using a less 
contentious structure. Most of the uses of given/when are syntactic
sugar. But there are some uses of the smartmatch operator '~~' in
indexing which may be affected by the various changes in behaviour.

Incidentally on a make test on perl 5.18.1 a lot of the Quey Parser
tests fail, but I havent as yet looked at this.

Colin



--

Colin Campbell
Chief Software Engineer,
PTFS Europe Limited
Content Management and Library Solutions
+44 (0) 800 756 6803 (phone)
+44 (0) 7759 633626  (mobile)
colin.campbell at ptfs-europe.com
skype: colin_campbell2

http://www.ptfs-europe.com


More information about the Koha-devel mailing list