File Coverage

blib/lib/Mojolicious/Plugin.pm
Criterion Covered Total %
statement 6 7 85.7
branch n/a
condition n/a
subroutine 2 3 66.6
pod 1 1 100.0
total 9 11 81.8


line stmt bran cond sub pod time code
1             package Mojolicious::Plugin;
2 49     49   425 use Mojo::Base -base;
  49         165  
  49         652  
3              
4 49     49   415 use Carp qw(croak);
  49         188  
  49         5346  
5              
6 0     0 1   sub register { croak 'Method "register" not implemented by subclass' }
7              
8             1;
9              
10             =encoding utf8
11              
12             =head1 NAME
13              
14             Mojolicious::Plugin - Plugin base class
15              
16             =head1 SYNOPSIS
17              
18             # CamelCase plugin name
19             package Mojolicious::Plugin::MyPlugin;
20             use Mojo::Base 'Mojolicious::Plugin', -signatures;
21              
22             sub register ($self, $app, $conf) {
23              
24             # Magic here! :)
25             }
26              
27             =head1 DESCRIPTION
28              
29             L is an abstract base class for L plugins.
30              
31             See L for a list of plugins that are available by default.
32              
33             =head1 METHODS
34              
35             L inherits all methods from L and implements the following new ones.
36              
37             =head2 register
38              
39             $plugin->register(Mojolicious->new);
40             $plugin->register(Mojolicious->new, {foo => 'bar'});
41              
42             This method will be called by L at startup time. Meant to be overloaded in a subclass.
43              
44             =head1 SEE ALSO
45              
46             L, L, L.
47              
48             =cut