File Coverage

blib/lib/Sentry/SourceFileRegistry.pm
Criterion Covered Total %
statement 15 31 48.3
branch 0 2 0.0
condition n/a
subroutine 5 7 71.4
pod 0 1 0.0
total 20 41 48.7


line stmt bran cond sub pod time code
1             use Mojo::Base -base, -signatures;
2 4     4   24  
  4         7  
  4         22  
3             use Mojo::File;
4 4     4   744 use Mojo::Util 'dumper';
  4         7  
  4         120  
5 4     4   18 use Sentry::Cache;
  4         7  
  4         137  
6 4     4   1382 use Sentry::SourceFileRegistry::ContextLine;
  4         8  
  4         25  
7 4     4   1493  
  4         9  
  4         24  
8             has _cache => sub { Sentry::Cache->get_instance };
9              
10             my $context = $self->_cache->get($file);
11 0     0      
  0            
  0            
  0            
12 0           if (!$context) {
13             my $content = Mojo::File->new($file)->slurp;
14 0 0         $context
15 0           = Sentry::SourceFileRegistry::ContextLine->new(content => $content);
16 0           $self->_cache->set($file, $context);
17             }
18 0            
19             return $context;
20             }
21 0            
22             return $self->_get_cached_context_line($file)->get($line);
23             }
24 0     0 0    
  0            
  0            
  0            
  0            
25 0           1;