| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package WWW::Slides::SlideTracker; | 
| 2 |  |  |  |  |  |  | { | 
| 3 | 10 |  |  | 10 |  | 27981 | use version; our $VERSION = qv('0.0.3'); | 
|  | 10 |  |  |  |  | 7039 |  | 
|  | 10 |  |  |  |  | 72 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 10 |  |  | 10 |  | 958 | use warnings; | 
|  | 10 |  |  |  |  | 21 |  | 
|  | 10 |  |  |  |  | 329 |  | 
| 6 | 10 |  |  | 10 |  | 53 | use strict; | 
|  | 10 |  |  |  |  | 17 |  | 
|  | 10 |  |  |  |  | 391 |  | 
| 7 | 10 |  |  | 10 |  | 50 | use Carp; | 
|  | 10 |  |  |  |  | 15 |  | 
|  | 10 |  |  |  |  | 634 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 10 |  |  | 10 |  | 4393 | use Object::InsideOut; | 
|  | 10 |  |  |  |  | 198000 |  | 
|  | 10 |  |  |  |  | 81 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | # Module implementation here | 
| 12 |  |  |  |  |  |  | my @slide_show : Field    # Where we're getting the slides from | 
| 13 |  |  |  |  |  |  | : Std(Name => 'slide_show', Private => 1) | 
| 14 |  |  |  |  |  |  | : Get(Name => 'slide_show', Private => 1) | 
| 15 |  |  |  |  |  |  | : Arg(Name => 'slide_show', Mandatory => 1); | 
| 16 |  |  |  |  |  |  | my @current : Field       # Main slide for talk | 
| 17 |  |  |  |  |  |  | : Std(Name => 'current') : Arg(Name => 'current') | 
| 18 |  |  |  |  |  |  | : Get(Name => 'current'); | 
| 19 |  |  |  |  |  |  | my @served_slides : Field    # Track already-sent slides | 
| 20 |  |  |  |  |  |  | : Std(Name => 'served_slides', Private => 1); | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | sub _init : Init { | 
| 23 | 6 |  |  |  |  | 28496 | my $self = shift; | 
| 24 | 6 |  |  |  |  | 214 | $self->set_served_slides({}); | 
| 25 | 6 | 50 |  |  |  | 539 | $self->goto($self->slide_show()->id_first()) | 
| 26 |  |  |  |  |  |  | unless defined $self->current(); | 
| 27 | 6 |  |  |  |  | 105 | return; | 
| 28 | 10 |  |  | 10 |  | 1835 | } | 
|  | 10 |  |  |  |  | 20 |  | 
|  | 10 |  |  |  |  | 82 |  | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | sub already_served_current { | 
| 31 | 27 |  |  | 27 | 1 | 11256 | my $self = shift; | 
| 32 | 27 |  |  |  |  | 745 | return exists $self->get_served_slides()->{$self->current()}; | 
| 33 |  |  |  |  |  |  | } | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | sub current_still_unserved { | 
| 36 | 9 |  |  | 9 | 1 | 4607 | my $self = shift; | 
| 37 | 9 |  |  |  |  | 25 | return !($self->already_served_current()); | 
| 38 |  |  |  |  |  |  | } | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | sub mark_current { | 
| 41 | 9 |  |  | 9 | 1 | 3142 | my $self = shift; | 
| 42 | 9 |  |  |  |  | 246 | $self->get_served_slides()->{$self->current()} = 1; | 
| 43 | 9 |  |  |  |  | 661 | return; | 
| 44 |  |  |  |  |  |  | } | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | sub goto { | 
| 47 | 10 |  |  | 10 | 1 | 1216 | my $self = shift; | 
| 48 | 10 |  |  |  |  | 17 | my ($slide_no) = @_; | 
| 49 | 10 | 50 |  |  |  | 275 | return unless $self->slide_show()->validate_slide_id($slide_no); | 
| 50 | 10 |  |  |  |  | 1309 | $self->set_current($slide_no); | 
| 51 | 10 |  |  |  |  | 71 | return; | 
| 52 |  |  |  |  |  |  | } | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | sub get_next { | 
| 55 | 3 |  |  | 3 | 1 | 735 | my $self = shift; | 
| 56 | 3 |  |  |  |  | 88 | return $self->slide_show()->id_next($self->current()); | 
| 57 |  |  |  |  |  |  | } | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | sub goto_next { | 
| 60 | 1 |  |  | 1 | 1 | 577 | my $self = shift; | 
| 61 | 1 |  |  |  |  | 5 | $self->goto($self->get_next()); | 
| 62 | 1 |  |  |  |  | 16 | return; | 
| 63 |  |  |  |  |  |  | } | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | sub get_previous { | 
| 66 | 3 |  |  | 3 | 1 | 688 | my $self = shift; | 
| 67 | 3 |  |  |  |  | 86 | return $self->slide_show()->id_previous($self->current()); | 
| 68 |  |  |  |  |  |  | } | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | sub goto_previous { | 
| 71 | 1 |  |  | 1 | 1 | 445 | my $self = shift; | 
| 72 | 1 |  |  |  |  | 5 | $self->goto($self->get_previous()); | 
| 73 | 1 |  |  |  |  | 4 | return; | 
| 74 |  |  |  |  |  |  | } | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | sub get_first { | 
| 77 | 3 |  |  | 3 | 1 | 543 | my $self = shift; | 
| 78 | 3 |  |  |  |  | 161 | return $self->slide_show()->id_first(); | 
| 79 |  |  |  |  |  |  | } | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | sub goto_first { | 
| 82 | 1 |  |  | 1 | 1 | 469 | my $self = shift; | 
| 83 | 1 |  |  |  |  | 6 | $self->goto($self->get_first()); | 
| 84 | 1 |  |  |  |  | 4 | return; | 
| 85 |  |  |  |  |  |  | } | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | sub get_last { | 
| 88 | 3 |  |  | 3 | 1 | 888 | my $self = shift; | 
| 89 | 3 |  |  |  |  | 108 | return $self->slide_show()->id_last(); | 
| 90 |  |  |  |  |  |  | } | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | sub goto_last { | 
| 93 | 1 |  |  | 1 | 1 | 446 | my $self = shift; | 
| 94 | 1 |  |  |  |  | 9 | $self->goto($self->get_last()); | 
| 95 | 1 |  |  |  |  | 4 | return; | 
| 96 |  |  |  |  |  |  | } | 
| 97 |  |  |  |  |  |  | } | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | 1;    # Magic true value required at end of module | 
| 100 |  |  |  |  |  |  | __END__ |