File Coverage

lib/List/Objects/WithUtils/Role/Array/TiedRO.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
total 12 12 100.0


line stmt bran cond sub code
1         package List::Objects::WithUtils::Role::Array::TiedRO;
2 3     3 use strictures 1;
  3        
  3        
3 3     3 use Carp ();
  3        
  3        
4          
5         # This role can be applied to the objects backing tied arrays
6         # after construction time in order to swap a mutable tied array
7         # for an immutable implementation;
8         # Array::Immutable::Typed::immarray_of does this in order to retain
9         # normal tied type array behavior until construction is complete.
10          
11 3     3 use Role::Tiny;
  3        
  3        
12          
13         around $_ => sub {
14           Carp::croak "Attempted to modify a read-only value"
15         } for qw/
16         STORE
17         STORESIZE
18         CLEAR
19         PUSH
20         POP
21         SHIFT
22         SPLICE
23         UNSHIFT
24         EXTEND
25         /;
26          
27         1;
28