line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: /mirror/gungho/lib/Gungho/Base.pm 31143 2007-11-27T06:57:15.188797Z lestrrat $ |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Copyright (c) 2007 Daisuke Maki <daisuke@endeworks.jp> |
4
|
|
|
|
|
|
|
# All rights reserved. |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Gungho::Base; |
7
|
1
|
|
|
1
|
|
46052
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
8
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
9
|
1
|
|
|
1
|
|
3
|
use base qw(Gungho::Base::Class Class::Accessor::Fast); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
318
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors($_) for qw(config); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new |
14
|
|
|
|
|
|
|
{ |
15
|
0
|
|
|
0
|
1
|
0
|
my $class = shift; |
16
|
0
|
|
|
|
|
0
|
my $self = bless { @_ }, $class; |
17
|
0
|
|
|
|
|
0
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub mk_virtual_methods |
21
|
|
|
|
|
|
|
{ |
22
|
2
|
|
|
2
|
1
|
3
|
my $class = shift; |
23
|
2
|
|
|
|
|
3
|
foreach my $method (@_) { |
24
|
2
|
|
|
|
|
2
|
my $slot = "${class}::${method}"; |
25
|
|
|
|
|
|
|
{ |
26
|
1
|
|
|
1
|
|
2580
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
60
|
|
|
2
|
|
|
|
|
2
|
|
27
|
2
|
|
|
0
|
|
4
|
*{$slot} = sub { die(ref($_[0]) . "::${method} is not overridden") }; |
|
2
|
|
|
|
|
11
|
|
|
0
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Gungho::Base - Base Class For Various Gungho Objects |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SYNOPSIS |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
package Gungho::Something; |
43
|
|
|
|
|
|
|
use base qw(Gungho::Base); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 MMETHODS |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 new(\%config) |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Creates a new object instance. Takes a config hashref. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 setup() |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Sets up the object. Use it like this in your object: |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub setup |
56
|
|
|
|
|
|
|
{ |
57
|
|
|
|
|
|
|
my $self = shift; |
58
|
|
|
|
|
|
|
# do custom setup |
59
|
|
|
|
|
|
|
$self->next::method(@_); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 mk_virtual_methods |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Creates virtual methods (methods that must be overridden). |
65
|
|
|
|
|
|
|
These methods will C<die()> unless you provide an implementation in your |
66
|
|
|
|
|
|
|
subclass |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |