add files
|
1 |
package Mojolicious::Plugin; |
2 |
use Mojo::Base -base; |
|
3 | ||
4 |
use Carp 'croak'; |
|
5 | ||
6 |
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'; |
|
21 | ||
22 |
sub register { |
|
23 |
my ($self, $app, $conf) = @_; |
|
24 | ||
25 |
# Magic here! :) |
|
26 |
} |
|
27 | ||
28 |
=head1 DESCRIPTION |
|
29 | ||
30 |
L<Mojolicious::Plugin> is an abstract base class for L<Mojolicious> plugins. |
|
31 | ||
32 |
=head1 METHODS |
|
33 | ||
34 |
L<Mojolicious::Plugin> inherits all methods from L<Mojo::Base> and implements |
|
35 |
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 |
|
43 |
to be overloaded in a subclass. |
|
44 | ||
45 |
=head1 SEE ALSO |
|
46 | ||
47 |
L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>. |
|
48 | ||
49 |
=cut |