line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IRC::Mode::Single; |
2
|
|
|
|
|
|
|
$IRC::Mode::Single::VERSION = '0.092002'; |
3
|
2
|
|
|
2
|
|
4322
|
use strictures 2; |
|
2
|
|
|
|
|
1139
|
|
|
2
|
|
|
|
|
62
|
|
4
|
2
|
|
|
2
|
|
281
|
use Carp; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
205
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=pod |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=for Pod::Coverage FLAG MODE PARAM |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=cut |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub FLAG () { 0 } |
13
|
|
|
|
|
|
|
sub MODE () { 1 } |
14
|
|
|
|
|
|
|
sub PARAM () { 2 } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use overload |
17
|
0
|
|
|
0
|
|
0
|
bool => sub { 1 }, |
18
|
2
|
|
|
|
|
15
|
'""' => 'as_string', |
19
|
2
|
|
|
2
|
|
7
|
fallback => 1; |
|
2
|
|
|
|
|
2
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new { |
23
|
6
|
50
|
|
6
|
1
|
607
|
confess "Expected at least a flag and mode" unless @_ >= 3; |
24
|
6
|
|
|
|
|
23
|
bless [ @_[1 .. $#_] ], $_[0] |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
1
|
1
|
347
|
sub flag { $_[0]->[FLAG] } |
28
|
1
|
|
|
1
|
1
|
3
|
sub char { $_[0]->[MODE] } |
29
|
1
|
|
|
1
|
1
|
4
|
sub param { $_[0]->[PARAM] } |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub as_string { |
32
|
2
|
|
|
2
|
1
|
4
|
my ($self) = @_; |
33
|
2
|
50
|
|
|
|
11
|
$self->[FLAG] . $self->[MODE] |
34
|
|
|
|
|
|
|
. (defined $self->[PARAM] ? ' '.$self->[PARAM] : '') |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
1
|
1
|
2
|
sub export { [ @{$_[0]} ] } |
|
1
|
|
|
|
|
4
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=pod |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 NAME |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
IRC::Mode::Single - A single IRC mode change |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 SYNOPSIS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $mode = IRC::Mode::Single->new( |
50
|
|
|
|
|
|
|
'+', 'o', 'avenj' |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $flag = $mode->flag; |
54
|
|
|
|
|
|
|
my $mode = $mode->char; |
55
|
|
|
|
|
|
|
my $arg = $mode->param; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 DESCRIPTION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
A simple ARRAY-type object representing a single mode change. |
60
|
|
|
|
|
|
|
These objects stringify into an IRC mode string. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Can be used to turn L mode ARRAYs |
63
|
|
|
|
|
|
|
into objects: |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
for my $mset (@$mode_array) { |
66
|
|
|
|
|
|
|
my $this_mode = IRC::Mode::Single->new( @$mset ); |
67
|
|
|
|
|
|
|
. . . |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Also see L |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 new |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Constructs a new mode change; expects at least a flag and mode. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 char |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
The mode character. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 flag |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
The '-' or '+' flag for this mode change. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 param |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
The parameter attached to the mode, if any. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 as_string |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Produces a mode string (with params attached) for this single mode change. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 export |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Retrieve the backing ARRAY without bless/overload magic. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 AUTHOR |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Jon Portnoy |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |