CLI/Role/State.pm

filter: Statementstmt 100% 20 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 100% 28 / 28 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« CLI/L10N/en.pm ↑ Summary
1 #=============================================================================
2 #
3 # Module: Term::CLI::State
4 #
5 # Description: Role for keeping state in Term::CLI objects.
6 #
7 # Author: Steven Bakker (SBAKKER), <cpanman@monkey-mind.net>
8 # Created: 09/02/2022
9 #
10 # Copyright (c) 2022 Steven Bakker
11 #
12 # This module is free software; you can redistribute it and/or modify
13 # it under the same terms as Perl itself. See "perldoc perlartistic."
14 #
15 # This software is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 #
19 #=============================================================================
20  
21 package Term::CLI::Role::State 0.061001;
22  
23 7 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 7 ▶use Types::Standard 1.000005 qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
27 HashRef
28 7 );
29  
30 7 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 7 ▶use namespace::clean 0.25;
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 has state => (
34 is => 'lazy',
35 isa => HashRef,
36 2 ▶ default => sub { {} },
Subroutine __ANON__: called CC=1 SCAR=0.0
37 7 );
38  
39 1 ▶sub clear_state {
Subroutine clear_state: called CC=1 SCAR=0.0
Pod documented
40 1 my ($self) = @_;
41 1 %{ $self->state } = ();
42 }
43  
44 7 1;
45  
46 __END__
« CLI/L10N/en.pm ↑ Summary