| 1 | package Catmandu::Plugin::Readonly; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | our $VERSION = '1.2025'; | |||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use Moo::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use MooX::Aliases; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use Package::Stash; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | sub BUILD { | ||||||||
|
Subroutine
BUILD: called CC=4 SCAR=15.0
Pod
undocumented
| |||||||||||
| 11 | 1 | my ($self) = @_; | |||||||||
| 12 | |||||||||||
| 13 | 1 | ▶ | if ($self->store->does('Catmandu::Droppable')) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 1 | Role::Tiny->apply_roles_to_object($self->store, | |||||||||
| 15 | qw(Catmandu::Plugin::Readonly::Droppable)); | ||||||||||
| 16 | } | ||||||||||
| 17 | 1 | ▶ | if ($self->does('Catmandu::Droppable')) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 1 | Role::Tiny->apply_roles_to_object($self, | |||||||||
| 19 | qw(Catmandu::Plugin::Readonly::Droppable)); | ||||||||||
| 20 | } | ||||||||||
| 21 | 1 | ▶ | if ($self->does('Catmandu::Searchable')) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 0 | Role::Tiny->apply_roles_to_object($self, | |||||||||
| 23 | qw(Catmandu::Plugin::Readonly::Searchable)); | ||||||||||
| 24 | } | ||||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 1 | ▶ | around add => sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 1 | my ($orig, $self, $data) = @_; | |||||||||
| 29 | 1 | my $pkg = ref($self); | |||||||||
| 30 | 1 | $self->log->warn("trying to add to readonly store"); | |||||||||
| 31 | 1 | my $err = Catmandu::NotImplemented->new("$pkg is readonly"); | |||||||||
| 32 | 1 | return undef, $err; | |||||||||
| 33 | 1 | }; | |||||||||
| 34 | |||||||||||
| 35 | 1 | ▶ | around delete => sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 36 | 1 | my ($orig, $self) = @_; | |||||||||
| 37 | 1 | my $pkg = ref($self); | |||||||||
| 38 | 1 | $self->log->warn("trying to delete from readonly store"); | |||||||||
| 39 | 1 | my $err = Catmandu::NotImplemented->new("$pkg is readonly"); | |||||||||
| 40 | 1 | return undef, $err; | |||||||||
| 41 | 1 | }; | |||||||||
| 42 | |||||||||||
| 43 | 0 | ▶ | around delete_all => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 44 | 0 | my ($orig, $self) = @_; | |||||||||
| 45 | 0 | my $pkg = ref($self); | |||||||||
| 46 | 0 | $self->log->warn("trying to delete_all on readonly store"); | |||||||||
| 47 | 0 | my $err = Catmandu::NotImplemented->new("$pkg is readonly"); | |||||||||
| 48 | 0 | return undef, $err; | |||||||||
| 49 | 1 | }; | |||||||||
| 50 | |||||||||||
| 51 | 1 | 1; | |||||||||
| 52 | |||||||||||
| 53 | __END__ | ||||||||||