lib/OAuthomatic/Internal/UsageGuard.pm

filter: Statementstmt 40.9% 9 / 22 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 40.0% 2 / 5 Podpod 0.0% 0 / 3 totaltotal 32.3% 11 / 34 CC 3 SCAR 13.9
CC
3
Cov
35%
prepare
6.0
finish
6.0
DEMOLISH
2.0
CRAP 4.0
« blib/lib/OAuthomatic/Internal/UsageGuard.pm ↑ Summary blib/lib/OAuthomatic/Server.pm »
1 package OAuthomatic::Internal::UsageGuard;
2 # ABSTRACT: support for RAII for some roles
3  
4  
5 5 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use namespace::sweep;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 5 has 'obj' => (is => 'ro', isa=>'Object');
9 5 has '_active' => (is=>'rw', isa=>'Bool');
10  
11 sub prepare {
12 0 ▶ my $self = shift;
Subroutine prepare: not called CC=2 SCAR=17.9
Pod undocumented
13 0 ▶ return if $self->_active;
Branch: 1 branch
BranchTrueFalseTotal
if $self->_active 0 0 0
14 0 $self->obj->prepare_to_work;
15 0 $self->_active(1);
16 0 return;
17 }
18  
19 sub finish {
20 0 ▶ my $self = shift;
Subroutine finish: not called CC=2 SCAR=17.9
Pod undocumented
21 0 ▶ return unless $self->_active;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_active 0 0 0
22 0 $self->obj->cleanup_after_work;
23 0 $self->_active(0);
24 0 return;
25 }
26  
27 sub DEMOLISH {
28 0 ▶ my $self = shift;
Subroutine DEMOLISH: not called CC=1 SCAR=6.9
Pod undocumented
29 0 $self->finish;
30 0 return;
31 }
32  
33 5 1;
34  
35 __END__
36  
37 =pod
38  
39 =encoding UTF-8
40  
41 =head1 NAME
42  
43 OAuthomatic::Internal::UsageGuard - support for RAII for some roles
44  
45 =head1 VERSION
46  
47 version 0.0201
48  
49 =head1 DESCRIPTION
50  
51 Internally used by L<OAuthomatic>
52  
53 =head1 AUTHOR
54  
55 Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl>
56  
57 =head1 COPYRIGHT AND LICENSE
58  
59 This software is copyright (c) 2015 by Marcin Kasperski.
60  
61 This is free software; you can redistribute it and/or modify it under
62 the same terms as the Perl 5 programming language system itself.
63  
64 =cut
« blib/lib/OAuthomatic/Internal/UsageGuard.pm ↑ Summary blib/lib/OAuthomatic/Server.pm »