File Coverage

blib/lib/Metrics/Any/Adapter/Null.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 15 16 93.7


line stmt bran cond sub pod time code
1             # You may distribute under the terms of either the GNU General Public License
2             # or the Artistic License (the same terms as Perl itself)
3             #
4             # (C) Paul Evans, 2020 -- leonerd@leonerd.org.uk
5              
6             package Metrics::Any::Adapter::Null 0.08;
7              
8 4     4   811 use v5.14;
  4         13  
9 4     4   21 use warnings;
  4         6  
  4         316  
10              
11             =head1 NAME
12              
13             C - a metrics reporting adapter which does nothing
14              
15             =head1 DESCRIPTION
16              
17             This L adapter type contains an empty stub implementation of the
18             adapter API, allowing a module to invoke methods on its metrics collector that
19             do not do anything.
20              
21             A program would run with this adapter by default unless it has requested a
22             different one, via the C statement.
23              
24             =cut
25              
26             sub new
27             {
28 5     5 0 11 my $class = shift;
29 5         33 return bless {}, $class;
30             }
31              
32             # All of these are empty methods
33             foreach my $method (qw(
34             make_counter inc_counter_by
35             make_distribution report_distribution
36             make_gauge inc_gauge_by set_gauge_to
37             make_timer report_timer
38             )) {
39 4     4   22 no strict 'refs';
  4         6  
  4         294  
40       23     *$method = sub {};
41             }
42              
43             =head1 AUTHOR
44              
45             Paul Evans
46              
47             =cut
48              
49             0x55AA;