blib/lib/DBIx/Class/CDBICompat/ReadOnly.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 9 | 13 | 69.2 |
branch | n/a | ||
condition | n/a | ||
subroutine | 3 | 5 | 60.0 |
pod | 0 | 1 | 0.0 |
total | 12 | 19 | 63.1 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package # hide from PAUSE | ||||||
2 | DBIx::Class::CDBICompat::ReadOnly; | ||||||
3 | |||||||
4 | 2 | 2 | 731 | use strict; | |||
2 | 5 | ||||||
2 | 52 | ||||||
5 | 2 | 2 | 9 | use warnings; | |||
2 | 3 | ||||||
2 | 43 | ||||||
6 | |||||||
7 | 2 | 2 | 8 | use base 'DBIx::Class'; | |||
2 | 4 | ||||||
2 | 280 | ||||||
8 | |||||||
9 | sub make_read_only { | ||||||
10 | 0 | 0 | 0 | my $proto = shift; | |||
11 | 0 | 0 | $proto->add_trigger("before_$_" => sub { shift->throw_exception("$proto is read only") }) | ||||
12 | 0 | foreach qw/create delete update/; | |||||
13 | 0 | return $proto; | |||||
14 | } | ||||||
15 | |||||||
16 | 1; |