File Coverage

blib/lib/Date/DayOfWeek/Birthday.pm
Criterion Covered Total %
statement 14 17 82.3
branch 1 2 50.0
condition 2 6 33.3
subroutine 4 4 100.0
pod 0 1 0.0
total 21 30 70.0


line stmt bran cond sub pod time code
1             # $Header: /home/cvs/date-doomsday/lib/Date/DayOfWeek/Birthday.pm,v 1.4 2003/02/02 13:40:38 rbowen Exp $
2              
3             package Date::DayOfWeek::Birthday;
4 1     1   25022 use Date::DayOfWeek qw();
  1         3  
  1         15  
5              
6 1     1   4 use strict;
  1         2  
  1         25  
7 1     1   5 use vars qw(@ISA @EXPORT $VERSION);
  1         2  
  1         223  
8             require Exporter;
9             @ISA = qw(Exporter);
10              
11             @EXPORT = qw( birthday );
12             $VERSION = ( qw($Revision: 1.4 $) )[1];
13              
14             =head1 NAME
15              
16             Date::DayOfWeek::Birthday - Monday's child is fair of face ...
17              
18             =head1 SYNOPSIS
19              
20             use Date::DayOfWeek::Birthday;
21             $personality = birthday( 25, 10, 1971 ); # day month year
22              
23             =head1 DESCRIPTION
24              
25             Monday's child is fair of face.
26             Tuesday's child is full of grace.
27             Wednesday's child is full of woe.
28             Thursday's child has far to go.
29             Friday's child is loving and giving.
30             Saturday's child works hard for his living.
31             The child that is born on the Sabbath day
32             is great, and good, and fair, and gay.
33              
34             Although our Jewish friends would disagree with the designation of
35             Sunday as "the Sabbath day," the above poem puepoerts to describe the
36             character of an individual based on the day of their birth.
37              
38             I'm not certain as to the origins of this poem. I'm trying to track
39             that down.
40              
41             Note also that there are various other versions of this poem,
42             depending on which part of the world you come from. Another version,
43             for example, says that ...
44              
45             The child that is born on the Sabbath day
46             is bonny and blithe and good and gay.
47              
48             And yet another says that ...
49              
50             The child that is born on the Sabbath day
51             is witty and wise and good and gay.
52              
53             =head1 birthday
54              
55             $personality = birthday( 25, 10, 1971 ); # day month year
56              
57             =cut
58              
59             sub birthday {
60 4     4 0 11 my ($day, $month, $year) = @_;
61              
62 4 50 33     31 unless ( $day && $month && $year ) {
      33        
63 0         0 ( $day, $month, $year ) = ( localtime(time) )[ 3, 4, 5 ];
64 0         0 $month++;
65 0         0 $year += 1900;
66             }
67 4         13 my $dayofweek = Date::DayOfWeek::dayofweek( $day, $month, $year );
68            
69 4         9 my @days = (
70             "The child that is born on the Sabbath day\nis great, and good, and fair, and gay.",
71             "Monday's child is fair of face.",
72             "Tuesday's child is full of grace.",
73             "Wednesday's child is full of woe.",
74             "Thursday's child has far to go.",
75             "Friday's child is loving and giving.",
76             "Saturday's child works hard for his living.",
77             );
78              
79 4         23 return $days[$dayofweek];
80             }
81              
82             1;
83              
84             =head1 AUTHOR
85              
86             Rich Bowen ( rbowen@rcbowen.com )
87              
88             =head1 See Also
89              
90             Date::Doomsday
91              
92             Date::DayOfWeek
93              
94             The Oxford Companion to the Year (Bonnie Blackburn and Leofranc
95             Holford-Strevens. Oxford Press.)
96              
97             =cut
98              
99