File Coverage

blib/lib/Pod/Weaver/Role/Plugin.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod n/a
total 31 31 100.0


line stmt bran cond sub pod time code
1             package Pod::Weaver::Role::Plugin 4.018;
2             # ABSTRACT: a Pod::Weaver plugin
3              
4 10     10   129 use Moose::Role;
  10         24  
  10         91  
5              
6             # BEGIN BOILERPLATE
7 10     10   52635 use v5.20.0;
  10         34  
8 10     10   55 use warnings;
  10         24  
  10         416  
9 10     10   65 use utf8;
  10         22  
  10         81  
10 10     10   319 no feature 'switch';
  10         21  
  10         1151  
11 10     10   70 use experimental qw(postderef postderef_qq); # This experiment gets mainlined.
  10         17  
  10         82  
12             # END BOILERPLATE
13              
14 10     10   1241 use Params::Util qw(_HASHLIKE);
  10         21  
  10         812  
15              
16 10     10   76 use namespace::autoclean;
  10         18  
  10         87  
17              
18             #pod =head1 IMPLEMENTING
19             #pod
20             #pod This is the most basic role that all plugins must perform.
21             #pod
22             #pod =attr plugin_name
23             #pod
24             #pod This name must be unique among all other plugins loaded into a weaver. In
25             #pod general, this will be set up by the configuration reader.
26             #pod
27             #pod =cut
28              
29             has plugin_name => (
30             is => 'ro',
31             isa => 'Str',
32             required => 1,
33             );
34              
35             #pod =attr weaver
36             #pod
37             #pod This is the Pod::Weaver object into which the plugin was loaded. In general,
38             #pod this will be set up when the weaver is instantiated from config.
39             #pod
40             #pod =cut
41              
42             has weaver => (
43             is => 'ro',
44             isa => 'Pod::Weaver',
45             required => 1,
46             weak_ref => 1,
47             );
48              
49             has logger => (
50             is => 'ro',
51             lazy => 1,
52             handles => [ qw(log log_debug log_fatal) ],
53             default => sub {
54             $_[0]->weaver->logger->proxy({
55             proxy_prefix => '[' . $_[0]->plugin_name . '] ',
56             });
57             },
58             );
59              
60             1;
61              
62             __END__
63              
64             =pod
65              
66             =encoding UTF-8
67              
68             =head1 NAME
69              
70             Pod::Weaver::Role::Plugin - a Pod::Weaver plugin
71              
72             =head1 VERSION
73              
74             version 4.018
75              
76             =head1 PERL VERSION SUPPORT
77              
78             This module has the same support period as perl itself: it supports the two
79             most recent versions of perl. (That is, if the most recently released version
80             is v5.40, then this module should work on both v5.40 and v5.38.)
81              
82             Although it may work on older versions of perl, no guarantee is made that the
83             minimum required version will not be increased. The version may be increased
84             for any reason, and there is no promise that patches will be accepted to lower
85             the minimum required perl.
86              
87             =head1 ATTRIBUTES
88              
89             =head2 plugin_name
90              
91             This name must be unique among all other plugins loaded into a weaver. In
92             general, this will be set up by the configuration reader.
93              
94             =head2 weaver
95              
96             This is the Pod::Weaver object into which the plugin was loaded. In general,
97             this will be set up when the weaver is instantiated from config.
98              
99             =head1 IMPLEMENTING
100              
101             This is the most basic role that all plugins must perform.
102              
103             =head1 AUTHOR
104              
105             Ricardo SIGNES <rjbs@semiotic.systems>
106              
107             =head1 COPYRIGHT AND LICENSE
108              
109             This software is copyright (c) 2021 by Ricardo SIGNES.
110              
111             This is free software; you can redistribute it and/or modify it under
112             the same terms as the Perl 5 programming language system itself.
113              
114             =cut