Client/Trait/HashStore.pm

filter: Statementstmt 88.8% 24 / 27 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 9 / 12 Podpod n/a totaltotal 84.6% 33 / 39 CC 1 SCAR 0.4
CC
1
Cov
89%
__ANON__
1.1
delete_session
1.1
delete_stash
1.1
CRAP 1.0
« Client/ApiUserAgentBuilder.pm ↑ Summary Client/Error.pm »
1 package OIDC::Client::Trait::HashStore;
2 5 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use OIDC::Client::Utils qw(reach_data affect_data delete_data);
Subroutine BEGIN: called CC=1 SCAR=0.0
6
7 =encoding utf8
8
9 =head1 NAME
10
11 OIDC::Client::Trait::HashStore - Moose Trait for hashref stores
12
13 =head1 DESCRIPTION
14
15 This Moose Trait automatically adds methods to the instances of the class
16 based on the name of the attribute using it.
17
18 Used by the C<OIDC::Client::Plugin::session> attribute, it adds read_session(), write_session()
19 and delete_session() methods to the instances of the L<OIDC::Client::Plugin> class.
20
21 Used by the C<OIDC::Client::Plugin::stash> attribute, it adds read_stash(), write_stash()
22 and delete_stash() methods to the instances of the L<OIDC::Client::Plugin> class.
23
24 C<read_${name}> method calls the L<OIDC::Client::Utils/"reach_data( $data_tree, \@path, $optional )">
25 function.
26
27 C<write_${name}> method calls the L<OIDC::Client::Utils/"affect_data( $data_tree, \@path, $value )">
28 function.
29
30 C<delete_${name}> method calls the L<OIDC::Client::Utils/"delete_data( $data_tree, \@path )">
31 function.
32
33 =cut
34
35 8 ▶after 'install_accessors' => sub {
Subroutine __ANON__: called CC=1 SCAR=0.1
36 8 my $self = shift;
37 8 my $realclass = $self->associated_class();
38 8 my $name = $self->name;
39 0 ▶ $realclass->add_method("read_${name}" => sub { return scalar reach_data( $_[0]->$name, $_[1]) });
Subroutine read_session: called CC=1 SCAR=0.4
Subroutine __ANON__: not called CC=1 SCAR=0.4
40 8 ▶ $realclass->add_method("write_${name}" => sub { return scalar affect_data($_[0]->$name, $_[1], $_[2]) });
Subroutine write_session: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
41 0 ▶ $realclass->add_method("delete_${name}" => sub { return scalar delete_data ($_[0]->$name, $_[1]) });
Subroutine delete_session: not called CC=1 SCAR=1.2
Subroutine __ANON__: not called CC=1 SCAR=1.2
Subroutine delete_stash: called CC=1 SCAR=1.2
42 2 };
43
44 2 1;
« Client/ApiUserAgentBuilder.pm ↑ Summary Client/Error.pm »