modulereview
Cow1337killr
<p>My thesis is that the [metamod://Switch] module should be marked deprecated.</p>
<p>One will find that many Perl Monks advise fellow programmers not to use the [metamod://Switch] module in any Perl program that even hints at eventually becoming production status source code. (The evidence is in the paragraphs below.)</p>
<p>This proposed deprecation marking is for the benefit of beginning and intermediate Perl programmers.</p>
<p>In most cases, advanced Perl programmers know better than to use it in serious source code, because many of them spend time at [link://http://www.perlmonks.org/|Perl Monks] , [link://http://stackoverflow.com/questions/tagged/perl|stackoverflow], or in IRC channels devoted to Perl programming and see the (sad) results of beginning and intermediate Perl programmers being lured into using this module.</p>
<p>Let me mention its history, briefly. The [metamod://Switch] module was once a core module in Perl. (Of course, one can use [metamod://corelist] to get the details.)</p>
<code>% corelist Switch
Data for 2016-06-20
Switch was first released with perl v5.7.3, deprecated (will be CPAN-only) in v5.11.0 and removed from v5.13.1</code>
<p>One more administrative detail to deal with here: This review is part of a larger project to deprecate the [metamod://Switch] module. For details, please read this post describing [id://1168998|a step by step recipe for deprecating this module (or any module)] by [hippo].</p>
<p>Below, I offer some hyperlinks that (I hope) will convince the reader that the [metamod://Switch] module should be deprecated.
<ul>
<li>[id://1167020|The thread entitled Switch depreciated?]
<p>Summary: A Perl programmer is confused because Perl::Critic complains that the [metamod://Switch] module is deprecated.</p></li>
<li>[id://512548|The thread entitled Perl Switch Errors on certain version]
<p>Summary: A Perl programmer seeks advice regarding an error message due to using the [metamod://Switch] module. If one reads through the replies, one will eventually see one where [Corion] directs us to a post by [TheDamian|Damian Conway] that categorizes [TheDamian|Damian's] modules. Of course, [metamod://Switch] is in this list (because [TheDamian|Damian Conway] was the author).</p></li>
<li>[id://486756|The post entitled Categorized Damian Modules]
<p>Summary: This is the post referred to in [Corion]'s post (that is described above).</p></li>
</ul></p>
<p>I have "set the table". By now, the reader should be thinking "Such a strange module with a strange history". If you are "ready to dine", please read on.</p>
<p>In the recent post by [hippo] entitled [id://1168998|Re^7: Perl Code Changes Behavior if Two Subroutine definitions are swapped], he references a [metamod://Switch] module bug report:
<ul>
<li>[rt://86969|Bug #86969 for Switch: documentation bugs: deprecatedness, maintainer?]
<p>Summary: I offer no summary; I don't want to spoil it for you.</p></li>
</ul></p>
<p>If the reader is still here at this point, it must be because he/she craves still more detail, because the bug report mentioned above should have satiated most of the audience. But, I can offer more for those that are "still hungry".</p>
<p>Here are some Perl Monks threads on the subject. It is not a complete list. For this task, I did a Google search with a query of [google://site:perlmonks.org switch].
<ul>
<li>[id://1143545|The thread entitled switch statement]
<p>Summary: A thread about the [metamod://Switch] module and possible alternatives.</p></li>
<li>[id://931563|The thread entitled Switch Module on Perl 5.8.0]
<p>Summary: A Perl programmer gets funny results using [metamod://Switch]. He removes [metamod://Switch]. His program works.</p></li>
<li>[id://811172|The thread entitled Syntax error with use constant and switch with comment between]
<p>Summary: Read this one if you want a chuckle.</p></li>
<li>[id://1168641|The thread entitled Perl Code Changes Behavior if Two Subroutine definitions are swapped]
<p>Summary: The latest Seekers of Perl Wisdom question involving the [metamod://Switch] module (at the time of this writing) which indirectly led to this effort to mark the [metamod://Switch] module deprecated.</p></li>
</ul></p>
<p>I hope that this review has convinced the reader that the [metamod://Switch] module should be marked deprecated.</p>
Switch - A switch statement for Perl, do not use if you can use given/when
The Switch module should be marked deprecated.