line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: /mirror/gungho/lib/Gungho/Component.pm 8910 2007-11-12T01:05:01.438419Z lestrrat $ |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Copyright (c) 2007 Daisuke Maki <daisuke@endeworks.jp> |
4
|
|
|
|
|
|
|
# All rights reserved. |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Gungho::Component; |
7
|
2
|
|
|
2
|
|
8
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
40
|
|
8
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
37
|
|
9
|
2
|
|
|
2
|
|
10
|
use base qw(Gungho::Base::Class); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
386
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub feature_name |
12
|
|
|
|
|
|
|
{ |
13
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
14
|
0
|
|
0
|
|
|
|
my $name = ref $class || $class; |
15
|
0
|
|
|
|
|
|
$name =~ s/^Gungho::Component:://; |
16
|
0
|
|
|
|
|
|
$name; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
1; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
__END__ |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Gungho::Component - Component Base Class For Gungho |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 SYNOPSIS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
package MyComponent; |
30
|
|
|
|
|
|
|
use base qw(Gungho::Component); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# in your conf |
33
|
|
|
|
|
|
|
--- |
34
|
|
|
|
|
|
|
components: |
35
|
|
|
|
|
|
|
- +MyComponent |
36
|
|
|
|
|
|
|
- Authentication::Basic |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 DESCRIPTION |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Gungho::Component is yet another way to modify Gungho's behavior. It differs |
41
|
|
|
|
|
|
|
from plugins in that it adds directly to Gungho's internals via subclassing. |
42
|
|
|
|
|
|
|
Plugins are called from various hooks, but components can directly interfere |
43
|
|
|
|
|
|
|
and/or add functionality to Gungho. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
To add a new component, just create a Gungho::Component subclass, and add |
46
|
|
|
|
|
|
|
it in your config. Gungho will ensure that it is loaded and setup. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 METHODS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 feature_name() |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Returns the name of the feature that this component provides. By default |
53
|
|
|
|
|
|
|
it's the package name with "Gungho::Component::" stripped out. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|