File Coverage

blib/lib/Net/LiveJournal/Entry.pm
Criterion Covered Total %
statement 9 37 24.3
branch 0 2 0.0
condition 0 12 0.0
subroutine 3 17 17.6
pod 0 14 0.0
total 12 82 14.6


line stmt bran cond sub pod time code
1             package Net::LiveJournal::Entry;
2 1     1   11 use strict;
  1         2  
  1         35  
3 1     1   5 use warnings;
  1         2  
  1         37  
4 1     1   5 use Carp qw(croak);
  1         1  
  1         742  
5              
6             sub new {
7 0     0 0   my ($class, %opts) = @_;
8 0           my $self = bless {}, $class;
9              
10 0   0       $self->{body} = delete $opts{body} || delete $opts{event};
11 0   0       $self->{subject} = delete $opts{subject} || "";
12 0   0       $self->{security} = delete $opts{security} || "public";
13 0   0       $self->{allowmask} = delete $opts{allowmask} || 0;
14 0   0       $self->{usejournal} = delete $opts{usejournal} || delete $opts{community} || delete $opts{journal};
15              
16 0           my @now = localtime();
17 0           $self->{year} = $now[5]+1900;
18 0           $self->{mon} = $now[4]+1;
19 0           $self->{day} = $now[3];
20 0           $self->{hour} = $now[2];
21 0           $self->{min} = $now[1];
22              
23 0 0         croak("Unknown options: " . join(", ", %opts)) if %opts;
24 0           return $self;
25             }
26              
27 0     0 0   sub year { $_[0]{year} }
28 0     0 0   sub month { $_[0]{mon} }
29 0     0 0   sub mon { $_[0]{mon} }
30 0     0 0   sub day { $_[0]{day} }
31 0     0 0   sub hour { $_[0]{hour} }
32 0     0 0   sub min { $_[0]{min} }
33 0     0 0   sub minute { $_[0]{min} }
34              
35 0     0 0   sub body { $_[0]{body} }
36 0     0 0   sub subject { $_[0]{subject} }
37 0     0 0   sub allowmask { $_[0]{allowmask} }
38 0     0 0   sub security { $_[0]{security} }
39              
40 0     0 0   sub usejournal { $_[0]{usejournal} }
41 0     0 0   sub journal { $_[0]{usejournal} }
42              
43             1;