| 1 | package OurCal::Event; | ||||||||||||
| 2 | |||||||||||||
| 3 | |||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | =head1 NAME | ||||||||||||
| 7 | |||||||||||||
| 8 | OurCal::Event - an event class for OurCal | ||||||||||||
| 9 | |||||||||||||
| 10 | =head1 METHODS | ||||||||||||
| 11 | |||||||||||||
| 12 | =head2 new <param[s]> | ||||||||||||
| 13 | |||||||||||||
| 14 | Requires a description and a date (in C<yyyy-mm-dd> form. | ||||||||||||
| 15 | |||||||||||||
| 16 | Can also take id, recurring (boolean) and editable (boolean) params. | ||||||||||||
| 17 | |||||||||||||
| 18 | =cut | ||||||||||||
| 19 | |||||||||||||
| 20 | 0 | ▶ | sub new { | ||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 21 | 0 | my ($class, %event) = @_; | |||||||||||
| 22 | 0 | return bless \%event, $class; | |||||||||||
| 23 | } | ||||||||||||
| 24 | |||||||||||||
| 25 | =head2 description | ||||||||||||
| 26 | |||||||||||||
| 27 | The description of the event | ||||||||||||
| 28 | |||||||||||||
| 29 | =cut | ||||||||||||
| 30 | |||||||||||||
| 31 | 0 | ▶ | sub description { | ||||||||||
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 32 | 0 | my $self = shift; | |||||||||||
| 33 | 0 | return $self->_trim($self->{description}); | |||||||||||
| 34 | } | ||||||||||||
| 35 | |||||||||||||
| 36 | |||||||||||||
| 37 | =head2 date | ||||||||||||
| 38 | |||||||||||||
| 39 | The date of the event in C<yyy-mm-dd> form. | ||||||||||||
| 40 | |||||||||||||
| 41 | =cut | ||||||||||||
| 42 | |||||||||||||
| 43 | 0 | ▶ | sub date { | ||||||||||
|
Subroutine
date: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 44 | 0 | my $self = shift; | |||||||||||
| 45 | 0 | return $self->{date}; | |||||||||||
| 46 | } | ||||||||||||
| 47 | |||||||||||||
| 48 | =head2 id | ||||||||||||
| 49 | |||||||||||||
| 50 | The id of the event (may return undef). | ||||||||||||
| 51 | |||||||||||||
| 52 | =cut | ||||||||||||
| 53 | |||||||||||||
| 54 | 0 | ▶ | sub id { | ||||||||||
|
Subroutine
id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 55 | 0 | my $self = shift; | |||||||||||
| 56 | 0 | return $self->{id}; | |||||||||||
| 57 | } | ||||||||||||
| 58 | |||||||||||||
| 59 | =head2 recurring | ||||||||||||
| 60 | |||||||||||||
| 61 | Is the event recurring | ||||||||||||
| 62 | |||||||||||||
| 63 | =cut | ||||||||||||
| 64 | |||||||||||||
| 65 | 0 | ▶ | sub recurring { | ||||||||||
|
Subroutine
recurring: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 66 | 0 | my $self = shift; | |||||||||||
| 67 | 0 | ▶ | return $self->{recurring} || 0; | ||||||||||
|
Condition0%0/2
$self->{'recurring'} || 0
MC/DC0%0/1
$self->{'recurring'} || 0
$self->{'recurring'}
Truth table0%0/2
A
A= $self->{'recurring'}
| |||||||||||||
| 68 | } | ||||||||||||
| 69 | |||||||||||||
| 70 | =head2 editable | ||||||||||||
| 71 | |||||||||||||
| 72 | Is this event editable. | ||||||||||||
| 73 | |||||||||||||
| 74 | =cut | ||||||||||||
| 75 | |||||||||||||
| 76 | 0 | ▶ | sub editable { | ||||||||||
|
Subroutine
editable: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 77 | 0 | my $self = shift; | |||||||||||
| 78 | 0 | ▶ | return $self->{editable} || 0; | ||||||||||
|
Condition0%0/2
$self->{'editable'} || 0
MC/DC0%0/1
$self->{'editable'} || 0
$self->{'editable'}
Truth table0%0/2
A
A= $self->{'editable'}
| |||||||||||||
| 79 | } | ||||||||||||
| 80 | |||||||||||||
| 81 | |||||||||||||
| 82 | 0 | ▶ | sub _trim { | ||||||||||
|
Subroutine
_trim: not called CC=1 SCAR=6.9
| |||||||||||||
| 83 | 0 | my($self, $text) = @_; | |||||||||||
| 84 | 0 | $text =~ s/^\s*(.+=?)\$/$1/; | |||||||||||
| 85 | 0 | return $text; | |||||||||||
| 86 | } | ||||||||||||
| 87 | |||||||||||||
| 88 | 2 | 1; | |||||||||||
| 89 | |||||||||||||