File Coverage

blib/lib/Pod/Weaver/Role/Plugin.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Pod::Weaver::Role::Plugin;
2             # ABSTRACT: a Pod::Weaver plugin
3             $Pod::Weaver::Role::Plugin::VERSION = '4.017';
4 10     10   84 use Moose::Role;
  10         23  
  10         118  
5              
6 10     10   57829 use Params::Util qw(_HASHLIKE);
  10         27  
  10         660  
7              
8 10     10   69 use namespace::autoclean;
  10         22  
  10         118  
9              
10             #pod =head1 IMPLEMENTING
11             #pod
12             #pod This is the most basic role that all plugins must perform.
13             #pod
14             #pod =attr plugin_name
15             #pod
16             #pod This name must be unique among all other plugins loaded into a weaver. In
17             #pod general, this will be set up by the configuration reader.
18             #pod
19             #pod =cut
20              
21             has plugin_name => (
22             is => 'ro',
23             isa => 'Str',
24             required => 1,
25             );
26              
27             #pod =attr weaver
28             #pod
29             #pod This is the Pod::Weaver object into which the plugin was loaded. In general,
30             #pod this will be set up when the weaver is instantiated from config.
31             #pod
32             #pod =cut
33              
34             has weaver => (
35             is => 'ro',
36             isa => 'Pod::Weaver',
37             required => 1,
38             weak_ref => 1,
39             );
40              
41             has logger => (
42             is => 'ro',
43             lazy => 1,
44             handles => [ qw(log log_debug log_fatal) ],
45             default => sub {
46             $_[0]->weaver->logger->proxy({
47             proxy_prefix => '[' . $_[0]->plugin_name . '] ',
48             });
49             },
50             );
51              
52             1;
53              
54             __END__
55              
56             =pod
57              
58             =encoding UTF-8
59              
60             =head1 NAME
61              
62             Pod::Weaver::Role::Plugin - a Pod::Weaver plugin
63              
64             =head1 VERSION
65              
66             version 4.017
67              
68             =head1 ATTRIBUTES
69              
70             =head2 plugin_name
71              
72             This name must be unique among all other plugins loaded into a weaver. In
73             general, this will be set up by the configuration reader.
74              
75             =head2 weaver
76              
77             This is the Pod::Weaver object into which the plugin was loaded. In general,
78             this will be set up when the weaver is instantiated from config.
79              
80             =head1 IMPLEMENTING
81              
82             This is the most basic role that all plugins must perform.
83              
84             =head1 AUTHOR
85              
86             Ricardo SIGNES <rjbs@cpan.org>
87              
88             =head1 COPYRIGHT AND LICENSE
89              
90             This software is copyright (c) 2021 by Ricardo SIGNES.
91              
92             This is free software; you can redistribute it and/or modify it under
93             the same terms as the Perl 5 programming language system itself.
94              
95             =cut