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