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   68192 use strict;
  134         233  
  134         3087  
3 134     134   479 use warnings;
  134         169  
  134         2522  
4 134     134   778 use Perl::Lint::Constants::Type;
  134         159  
  134         58592  
5 134     134   573 use parent "Perl::Lint::Policy";
  134         193  
  134         627  
6              
7             use constant {
8 134         18747 DESC => 'Tied variable used',
9             EXPL => [451],
10 134     134   6626 };
  134         209  
11              
12             sub evaluate {
13 5     5 0 7 my ($class, $file, $tokens, $args) = @_;
14              
15 5         5 my @violations;
16 5         17 for (my $i = 0; my $token = $tokens->[$i]; $i++) {
17 184 100 100     364 if ($token->{type} == BUILTIN_FUNC && $token->{data} eq 'tie') {
18             push @violations, {
19             filename => $file,
20             line => $token->{line},
21 17         52 description => DESC,
22             explanation => EXPL,
23             policy => __PACKAGE__,
24             };
25             }
26             }
27              
28 5         14 return \@violations;
29             }
30              
31             1;
32