blib/lib/App/Rgit/Guard.pm

filter: Statementstmt 100% 13 / 13 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 82.6% 19 / 23 CC 2 SCAR 3.8
CC
2
Cov
88%
new
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« blib/lib/App/Rgit/Utils.pm ↑ Summary blib/lib/App/Rgit/Policy/Default.pm »
1 package App::Rgit::Guard;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =head1 NAME
7  
8 App::Rgit::Guard - Scope guard helper for App::Rgit.
9  
10 =head1 VERSION
11  
12 Version 0.08
13  
14 =cut
15  
16 3 our $VERSION = '0.08';
17  
18 =head1 DESCRIPTION
19  
20 This class implements a simple scope guard object.
21  
22 This is an internal module to L<rgit>.
23  
24 =head1 METHODS
25  
26 =head2 C<new $callback>
27  
28 Creates a new C<App::Rgit::Guard> object that will call C<$callback> when it is destroyed.
29  
30 =cut
31  
32 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.6
Pod documented
33 4 my $class = shift;
34 4 ▶ $class = ref $class || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
040
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
35  
36 4 bless \($_[0]), $class;
37 }
38  
39 =head2 C<DESTROY>
40  
41 Invokes the callback when the guard object goes out of scope.
42  
43 =cut
44  
45 4 ▶sub DESTROY { ${$_[0]}->() }
Subroutine DESTROY: called CC=1 SCAR=0.0
46  
47 =head1 SEE ALSO
48  
49 L<rgit>.
50  
51 =head1 AUTHOR
52  
53 Vincent Pit, C<< <perl at profvince.com> >>, L<http://profvince.com>.
54  
55 You can contact me by mail or on C<irc.perl.org> (vincent).
56  
57 =head1 BUGS
58  
59 Please report any bugs or feature requests to C<bug-rgit at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=rgit>.
60 I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
61  
62 =head1 SUPPORT
63  
64 You can find documentation for this module with the perldoc command.
65  
66 perldoc App::Rgit::Guard
67  
68 =head1 COPYRIGHT & LICENSE
69  
70 Copyright 2008,2009,2010 Vincent Pit, all rights reserved.
71  
72 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
73  
74 =cut
75  
76 3 1; # End of App::Rgit::Guard
« blib/lib/App/Rgit/Utils.pm ↑ Summary blib/lib/App/Rgit/Policy/Default.pm »