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   68402 use strict;
  134         202  
  134         3283  
3 134     134   426 use warnings;
  134         180  
  134         2509  
4 134     134   772 use Perl::Lint::Constants::Type;
  134         163  
  134         60226  
5 134     134   582 use parent "Perl::Lint::Policy";
  134         203  
  134         634  
6              
7             use constant {
8 134         19301 DESC => 'Tied variable used',
9             EXPL => [451],
10 134     134   6910 };
  134         194  
11              
12             sub evaluate {
13 5     5 0 8 my ($class, $file, $tokens, $args) = @_;
14              
15 5         4 my @violations;
16 5         18 for (my $i = 0; my $token = $tokens->[$i]; $i++) {
17 184 100 100     370 if ($token->{type} == BUILTIN_FUNC && $token->{data} eq 'tie') {
18             push @violations, {
19             filename => $file,
20             line => $token->{line},
21 17         67 description => DESC,
22             explanation => EXPL,
23             policy => __PACKAGE__,
24             };
25             }
26             }
27              
28 5         16 return \@violations;
29             }
30              
31             1;
32