File Coverage

blib/lib/Crypt/SecretBuffer/Span.pm
Criterion Covered Total %
statement 14 15 93.3
branch n/a
condition 0 2 0.0
subroutine 6 7 85.7
pod 1 1 100.0
total 21 25 84.0


line stmt bran cond sub pod time code
1             package Crypt::SecretBuffer::Span;
2             # VERSION
3             # ABSTRACT: Reference a span of bytes within a SecretBuffer
4             $Crypt::SecretBuffer::Span::VERSION = '0.020';
5 23     23   141 use strict;
  23         40  
  23         869  
6 23     23   133 use warnings;
  23         36  
  23         1351  
7 23     23   178 use Crypt::SecretBuffer; # loads XS methods into this package
  23         67  
  23         208  
8             use overload 'cmp' => \&cmp,
9 0   0 0   0 '""' => sub { 'Span('.($_[0]->buf->stringify_mask||"[REDACTED]").', pos='.$_[0]->pos.', len='.$_[0]->len.')' },
10 23     23   172 'bool' => sub{1}; # span objects are always true
  23     311   49  
  23         413  
  311         1270  
11              
12              
13             # span holds a ref to buffer, and it's less effort to let perl see it for things like iThread cloning.
14 11     11 1 354636 sub buf { $_[0]{buf} }
15             *buffer= *buf;
16              
17              
18             # used by XS, can be localized
19             $Crypt::SecretBuffer::Span::default_trim_regex= qr/[\s]+/;
20              
21              
22             1;
23              
24             __END__