line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::MojoSlides::Slides; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
8721
|
use Mojo::Base -base; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
39
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
has first => 1; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has last => sub { |
8
|
|
|
|
|
|
|
my $self = shift; |
9
|
|
|
|
|
|
|
my $slides = $self->list or return 1; |
10
|
|
|
|
|
|
|
return @$slides; |
11
|
|
|
|
|
|
|
}; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'list'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
10
|
|
|
10
|
1
|
2997
|
my $class = shift; |
17
|
10
|
|
|
|
|
9
|
my $args; |
18
|
10
|
100
|
|
|
|
26
|
if (@_==1) { |
19
|
4
|
100
|
|
|
|
14
|
$args = { last => $_[0] } unless ref $_[0]; |
20
|
4
|
100
|
|
|
|
17
|
$args = { list => $_[0] } if ref $_[0] eq 'ARRAY'; |
21
|
|
|
|
|
|
|
} |
22
|
10
|
100
|
|
|
|
57
|
return $class->SUPER::new($args ? $args : @_); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub prev { |
26
|
7
|
|
|
7
|
1
|
99
|
my ($self, $current) = @_; |
27
|
7
|
100
|
|
|
|
21
|
return $current == $self->first ? $current : $current - 1; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub next { |
31
|
7
|
|
|
7
|
1
|
81
|
my ($self, $current) = @_; |
32
|
7
|
100
|
|
|
|
19
|
return $current == $self->last ? $current : $current + 1; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub template_for { |
36
|
4
|
|
|
4
|
1
|
37
|
my ($self, $num) = @_; |
37
|
4
|
50
|
|
|
|
13
|
return "$num" unless my $list = $self->list; |
38
|
0
|
|
|
|
|
|
return $list->[$num-1]; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |