Lines 1-31
Link Here
|
1 |
#!/usr/bin/perl |
|
|
2 |
# |
3 |
# Tests usage of deprecated Perl syntax. Deprecated could be extended to the |
4 |
# sense of 'not allowed'. |
5 |
# |
6 |
use warnings; |
7 |
use strict; |
8 |
use Test::NoWarnings; |
9 |
use Test::More tests => 2; |
10 |
use File::Find; |
11 |
use Cwd; |
12 |
|
13 |
my @files_with_switch = do { |
14 |
my @files; |
15 |
local $/ = undef; |
16 |
find( |
17 |
sub { |
18 |
my $dir = getcwd(); |
19 |
return if $dir =~ /blib/; |
20 |
return unless /\.(pl|pm)$/; # Don't inspect non-Perl files |
21 |
open my $fh, "<", $_; |
22 |
my $content = <$fh>; |
23 |
push @files, "$dir/$_" if $content =~ /switch\s*\(.*{/; |
24 |
}, |
25 |
('.') |
26 |
); |
27 |
@files; |
28 |
}; |
29 |
ok( !@files_with_switch, "Perl syntax: no use of switch statement" ) |
30 |
or diag( "Files list: " . join( ', ', @files_with_switch ) ); |
31 |
|
32 |
- |