Mojolicious/Plugin.pm

filter: Statementstmt 100% 8 / 8 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 100% 12 / 12 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
register
1.0
CRAP 1.0
« Mojolicious/Command/psgi.pm ↑ Summary
1 package Mojolicious::Plugin;
2 18 ▶use Mojo::Base -base;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 18 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶sub register { croak 'Method "register" not implemented by subclass' }
Subroutine register: called CC=1 SCAR=0.0
Pod documented
7  
8 18 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<Mojolicious::Plugin> is an abstract base class for L<Mojolicious> plugins.
30  
31 See L<Mojolicious::Plugins/"PLUGINS"> for a list of plugins that are available by default.
32  
33 =head1 METHODS
34  
35 L<Mojolicious::Plugin> inherits all methods from L<Mojo::Base> 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<Mojolicious::Plugins> at startup time. Meant to be overloaded in a subclass.
43  
44 =head1 SEE ALSO
45  
46 L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>.
47  
48 =cut
« Mojolicious/Command/psgi.pm ↑ Summary