| 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.10; | ||
| 7 | |||
| 8 | 4 | ▶ | use v5.14; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 4 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | =head1 NAME | ||
| 12 | |||
| 13 | C<Metrics::Any::Adapter::Null> - a metrics reporting adapter which does nothing | ||
| 14 | |||
| 15 | =head1 DESCRIPTION | ||
| 16 | |||
| 17 | This L<Metrics::Any> 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<use Metrics::Any::Adapter> statement. | ||
| 23 | |||
| 24 | This adapter type claims to support batch mode, though the reporting callback | ||
| 25 | will never be invoked. | ||
| 26 | |||
| 27 | =cut | ||
| 28 | |||
| 29 | sub new | ||
| 30 | 5 | ▶ | { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 31 | 5 | my $class = shift; | |
| 32 | 5 | return bless {}, $class; | |
| 33 | } | ||
| 34 | |||
| 35 | # All of these are empty methods | ||
| 36 | 4 | foreach my $method (qw( | |
| 37 | make_counter inc_counter_by | ||
| 38 | make_distribution report_distribution | ||
| 39 | make_gauge inc_gauge_by set_gauge_to | ||
| 40 | make_timer report_timer | ||
| 41 | )) { | ||
| 42 | 4 | ▶ | no strict 'refs'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 43 | 36 | ▶ | *$method = sub {}; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 44 | } | ||
| 45 | |||
| 46 | # Batch mode is supported but does nothing | ||
| 47 | 4 | ▶ | use constant HAVE_BATCH_MODE => 1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 48 | 1 | ▶ | sub add_batch_mode_callback {} |
|
Subroutine
add_batch_mode_callback: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 49 | |||
| 50 | =head1 AUTHOR | ||
| 51 | |||
| 52 | Paul Evans <leonerd@leonerd.org.uk> | ||
| 53 | |||
| 54 | =cut | ||
| 55 | |||
| 56 | 4 | 0x55AA; | |