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.019;
2             # ABSTRACT: a Pod::Weaver plugin
3              
4 10     10   115 use Moose::Role;
  10         23  
  10         102  
5              
6             # BEGIN BOILERPLATE
7 10     10   56944 use v5.20.0;
  10         38  
8 10     10   62 use warnings;
  10         23  
  10         420  
9 10     10   71 use utf8;
  10         21  
  10         103  
10 10     10   376 no feature 'switch';
  10         25  
  10         1266  
11 10     10   79 use experimental qw(postderef postderef_qq); # This experiment gets mainlined.
  10         21  
  10         98  
12             # END BOILERPLATE
13              
14 10     10   1315 use Params::Util qw(_HASHLIKE);
  10         25  
  10         706  
15              
16 10     10   81 use namespace::autoclean;
  10         30  
  10         94  
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.019
75              
76             =head1 PERL VERSION
77              
78             This module should work on any version of perl still receiving updates from
79             the Perl 5 Porters. This means it should work on any version of perl released
80             in the last two to three years. (That is, if the most recently released
81             version is v5.40, then this module should work on both v5.40 and v5.38.)
82              
83             Although it may work on older versions of perl, no guarantee is made that the
84             minimum required version will not be increased. The version may be increased
85             for any reason, and there is no promise that patches will be accepted to lower
86             the minimum required perl.
87              
88             =head1 ATTRIBUTES
89              
90             =head2 plugin_name
91              
92             This name must be unique among all other plugins loaded into a weaver. In
93             general, this will be set up by the configuration reader.
94              
95             =head2 weaver
96              
97             This is the Pod::Weaver object into which the plugin was loaded. In general,
98             this will be set up when the weaver is instantiated from config.
99              
100             =head1 IMPLEMENTING
101              
102             This is the most basic role that all plugins must perform.
103              
104             =head1 AUTHOR
105              
106             Ricardo SIGNES <cpan@semiotic.systems>
107              
108             =head1 COPYRIGHT AND LICENSE
109              
110             This software is copyright (c) 2023 by Ricardo SIGNES.
111              
112             This is free software; you can redistribute it and/or modify it under
113             the same terms as the Perl 5 programming language system itself.
114              
115             =cut