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.024';
5 26     26   194 use strict;
  26         50  
  26         1088  
6 26     26   152 use warnings;
  26         130  
  26         1548  
7 26     26   153 use Crypt::SecretBuffer; # loads XS methods into this package
  26         46  
  26         186  
8             use overload 'cmp' => \&cmp,
9 0   0 0   0 '""' => sub { 'Span('.($_[0]->buf->stringify_mask||"[REDACTED]").', pos='.$_[0]->pos.', len='.$_[0]->len.')' },
10 26     26   205 'bool' => sub{1}; # span objects are always true
  26     687   66  
  26         439  
  687         2413  
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 423985 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__