Acme-CPANModules-SmartMatch
view release on metacpan or search on metacpan
exactly.
In the end almost everyone agrees that smart matching is a bad fit for a
weakly typed language like Perl. The programmer needs to be explicit on
what type of operation should be done by specifying the appropriate
/operator/ (e.g. "==" vs "eq") instead of the operator deducing what
operation needs to be done depending on the operand, because in Perl the
operand's type is unclear. Mainly, a scalar can be a string, or a
number, or a bool, or all.
The roadmap to removal
In perl 5.18 (2013), 6 years after being introduced and used by
programmers without warning, smart match was declared as experimental,
which is weird if you think about it. You now have to add "use
experimental "smartmatch"" to silence the warning. What happens to the
"switch" statement then? Since it's tied to smart matching, it also gets
the same fate: became experimental in 5.18.
In perl 5.38 (2023) smart match is deprecated. You can no longer silence
the warning with "use experimental 'smartmatch'" and must replace the
lib/Acme/CPANModules/SmartMatch.pm view on Meta::CPAN
nobody was sure what smart matching should or should not do exactly.
In the end almost everyone agrees that smart matching is a bad fit for a weakly
typed language like Perl. The programmer needs to be explicit on what type of
operation should be done by specifying the appropriate /operator/ (e.g. `==` vs
`eq`) instead of the operator deducing what operation needs to be done depending
on the operand, because in Perl the operand's type is unclear. Mainly, a scalar
can be a string, or a number, or a bool, or all.
**The roadmap to removal**
In perl 5.18 (2013), 6 years after being introduced and used by programmers
without warning, smart match was declared as experimental, which is weird if you
think about it. You now have to add `use experimental "smartmatch"` to silence
the warning. What happens to the `switch` statement then? Since it's tied to
smart matching, it also gets the same fate: became experimental in 5.18.
In perl 5.38 (2023) smart match is deprecated. You can no longer silence the
warning with "use experimental 'smartmatch'" and must replace the use of smart
match with something else.
lib/Acme/CPANModules/SmartMatch.pm view on Meta::CPAN
Behaviors were changed from release to release, starting from 5.10.1. Then
nobody was sure what smart matching should or should not do exactly.
In the end almost everyone agrees that smart matching is a bad fit for a weakly
typed language like Perl. The programmer needs to be explicit on what type of
operation should be done by specifying the appropriate /operator/ (e.g. C<==> vs
C<eq>) instead of the operator deducing what operation needs to be done depending
on the operand, because in Perl the operand's type is unclear. Mainly, a scalar
can be a string, or a number, or a bool, or all.
B<The roadmap to removal>
In perl 5.18 (2013), 6 years after being introduced and used by programmers
without warning, smart match was declared as experimental, which is weird if you
think about it. You now have to add C<use experimental "smartmatch"> to silence
the warning. What happens to the C<switch> statement then? Since it's tied to
smart matching, it also gets the same fate: became experimental in 5.18.
In perl 5.38 (2023) smart match is deprecated. You can no longer silence the
warning with "use experimental 'smartmatch'" and must replace the use of smart
match with something else.
t/00-compile.t view on Meta::CPAN
use IO::Handle;
open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
my @warnings;
for my $lib (@module_files)
{
# see L<perlfaq8/How can I capture STDERR from an external command?>
my $stderr = IO::Handle->new;
diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} }
$^X, @switches, '-e', "require q[$lib]"))
if $ENV{PERL_COMPILE_TEST_DEBUG};
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
( run in 1.003 second using v1.01-cache-2.11-cpan-49f99fa48dc )