ProgressMonitor/Null.pm

filter: Statementstmt 81.2% 26 / 32 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 8 / 10 Podpod n/a totaltotal 77.2% 34 / 44 CC 2 SCAR 3.6
CC
2
Cov
76%
new
3.4
subMonitor
1.0
BEGIN
1.0
CRAP 1.4
« ProgressMonitor/Stringify/Fields/Fixed.pm ↑ Summary ProgressMonitor.pm »
1 package ProgressMonitor::Null;
2
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5
6 1 require ProgressMonitor if 0;
7
8 use classes
9 1 ▶ extends => 'ProgressMonitor',
Subroutine BEGIN: called CC=1 SCAR=0.0
10 new => 'new',
11 methods => {
12 begin => 'EMPTY',
13 end => 'EMPTY',
14 isCanceled => 'EMPTY',
15 prepare => 'EMPTY',
16 setCanceled => 'EMPTY',
17 setMessage => 'EMPTY',
18 setErrorMessage => 'EMPTY',
19 tick => 'EMPTY',
20 subMonitor => 'subMonitor',
21 },
22 class_attrs_pr => [ 'instance' ],
23 1 ;
24
25 sub new
26 0 ▶{
Subroutine new: not called CC=2 SCAR=12.2
27 0 my $class = shift;
28 0 my $cfg = shift;
29
30 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
31 0 ▶ unless ($$CLASS_ATTR_instance)
Branch: 1 branch
BranchTrueFalseTotal
unless ($$ProgressMonitor::Null::CLASS_ATTR_instance) 0 0 0
32 {
33 # don't pass any cfg; just discard it
34 #
35 0 $$CLASS_ATTR_instance = classes::new_only($class);
36 }
37
38 0 return $$CLASS_ATTR_instance;
39 }
40
41 sub subMonitor
42 0 ▶{
Subroutine subMonitor: not called CC=1 SCAR=0.2
43 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
44 0 return $$CLASS_ATTR_instance;
45 }
46
47 ###
48
49 package ProgressMonitor::NullConfiguration;
50
51 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
52 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
53
54 use classes
55 1 ▶ extends => 'ProgressMonitor::AbstractConfiguration',
Subroutine BEGIN: called CC=1 SCAR=0.0
56 1 ;
57
58 ############################
59
60 =head1 NAME
61
62 ProgressMonitor::Null - a monitor implementation which doesn't render anything.
63 Useful if a receiver insists on a monitor impl to talk to.
64
65 =head1 SYNOPSIS
66
67 ...
68 $someObj->someLongRunningMethod(ProgressMonitor::Null->new);
69 ...
70
71 ####
72
73 useful pattern inside a method that takes a monitor instance
74 but can accept undef for it:
75
76 someMethod
77 {
78 my $monitor = shift;
79
80 monitor = ProgressMonitor::Null->new unless $monitor;
81
82 ...
83 #now the rest of the code is guaranteed a monitor
84 ...
85 }
86
87 =head1 DESCRIPTION
88
89 This is a 'null' implementation of the ProgressMonitor interface. It will simply
90 ignore to render anything, thus it's a good dropin for a method that requires
91 a monitor instance but you don't wish anything shown.
92
93 Inherits from AbstractStatefulMonitor.
94
95 =head1 AUTHOR
96
97 Kenneth Olwing, C<< <knth at cpan.org> >>
98
99 =head1 BUGS
100
101 I wouldn't be surprised! If you can come up with a minimal test that shows the
102 problem I might be able to take a look. Even better, send me a patch.
103
104 Please report any bugs or feature requests to
105 C<bug-progressmonitor at rt.cpan.org>, or through the web interface at
106 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ProgressMonitor>.
107 I will be notified, and then you'll automatically be notified of progress on
108 your bug as I make changes.
109
110 =head1 SUPPORT
111
112 You can find general documentation for this module with the perldoc command:
113
114 perldoc ProgressMonitor
115
116 =head1 ACKNOWLEDGEMENTS
117
118 Thanks to my family. I'm deeply grateful for you!
119
120 =head1 COPYRIGHT & LICENSE
121
122 Copyright 2006,2007 Kenneth Olwing, all rights reserved.
123
124 This program is free software; you can redistribute it and/or modify it
125 under the same terms as Perl itself.
126
127 =cut
128
129 1 1; # End of ProgressMonitor::Null
« ProgressMonitor/Stringify/Fields/Fixed.pm ↑ Summary ProgressMonitor.pm »