line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Widget::Series; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
8997
|
use lib '../'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
698
|
use CGI::Widget; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
5
|
1
|
|
|
1
|
|
5
|
use vars qw(@ISA $VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
59
|
|
6
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
39
|
|
7
|
1
|
|
|
1
|
|
4
|
use overload '""' => \&html; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
@ISA = qw(CGI::Widget); |
10
|
|
|
|
|
|
|
$VERSION = '1.01'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _init { |
14
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
15
|
|
|
|
|
|
|
#clean out leading -'s; |
16
|
1
|
|
|
|
|
3
|
my @t = @_; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
|
|
6
|
for(my $i = 0; $i < @t; $i+=2){ $t[$i] =~ s/^-//; } |
|
2
|
|
|
|
|
13
|
|
20
|
1
|
|
|
|
|
4
|
my %param = @t; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
50
|
|
|
11
|
$param{break} ||= 0; |
23
|
1
|
|
50
|
|
|
10
|
$param{linebreak} ||= 0; |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
2
|
foreach my $i (qw(length render break linebreak)){ |
26
|
4
|
50
|
|
|
|
24
|
defined $param{$i} ? $self->$i($param{$i}) : die "$i undefined in $0 : $!"; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
5
|
return 1; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub html { |
33
|
2
|
|
|
2
|
0
|
554
|
my ($self,@args) = @_; |
34
|
|
|
|
|
|
|
|
35
|
2
|
50
|
|
|
|
8
|
$self = __PACKAGE__->new(@args) unless ref $self; |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
3
|
my $return = ''; |
38
|
2
|
|
|
|
|
5
|
for my $i (1..$self->length){ |
39
|
2
|
|
|
|
|
6
|
$return .= $self->render->($i); |
40
|
2
|
50
|
|
|
|
10
|
$return .= $self->linebreak ? ' ' : ''; |
41
|
2
|
50
|
|
|
|
6
|
$return .= $self->break ? "\n" : ''; |
42
|
|
|
|
|
|
|
} |
43
|
2
|
|
|
|
|
7
|
return $return; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub length { |
47
|
3
|
|
|
3
|
0
|
4
|
my($self,$val) = @_; |
48
|
3
|
100
|
|
|
|
12
|
return $self->{length} unless defined $val; |
49
|
1
|
|
|
|
|
94
|
$self->{length} = $val; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub render { |
53
|
3
|
|
|
3
|
0
|
5
|
my($self,$val) = @_; |
54
|
3
|
100
|
|
|
|
12
|
return $self->{render} unless defined $val; |
55
|
1
|
|
|
|
|
4
|
$self->{render} = $val; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub break { |
59
|
3
|
|
|
3
|
0
|
4
|
my($self,$val) = @_; |
60
|
3
|
100
|
|
|
|
13
|
return $self->{break} unless defined $val; |
61
|
1
|
|
|
|
|
3
|
$self->{break} = $val; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub linebreak { |
65
|
3
|
|
|
3
|
0
|
28
|
my($self,$val) = @_; |
66
|
3
|
100
|
|
|
|
12
|
return $self->{linebreak} unless defined $val; |
67
|
1
|
|
|
|
|
4
|
$self->{linebreak} = $val; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
__END__ |