File Coverage

blib/lib/Perl/Lint/Policy/Miscellanea/ProhibitTies.pm
Criterion Covered Total %
statement 21 21 100.0
branch 2 2 100.0
condition 3 3 100.0
subroutine 6 6 100.0
pod 0 1 0.0
total 32 33 96.9


line stmt bran cond sub pod time code
1             package Perl::Lint::Policy::Miscellanea::ProhibitTies;
2 134     134   89145 use strict;
  134         305  
  134         4884  
3 134     134   597 use warnings;
  134         238  
  134         3173  
4 134     134   1070 use Perl::Lint::Constants::Type;
  134         228  
  134         90986  
5 134     134   805 use parent "Perl::Lint::Policy";
  134         251  
  134         848  
6              
7             use constant {
8 134         24545 DESC => 'Tied variable used',
9             EXPL => [451],
10 134     134   8895 };
  134         273  
11              
12             sub evaluate {
13 5     5 0 12 my ($class, $file, $tokens, $args) = @_;
14              
15 5         8 my @violations;
16 5         27 for (my $i = 0; my $token = $tokens->[$i]; $i++) {
17 184 100 100     600 if ($token->{type} == BUILTIN_FUNC && $token->{data} eq 'tie') {
18 17         111 push @violations, {
19             filename => $file,
20             line => $token->{line},
21             description => DESC,
22             explanation => EXPL,
23             policy => __PACKAGE__,
24             };
25             }
26             }
27              
28 5         28 return \@violations;
29             }
30              
31             1;
32