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