blib/lib/Date/Leapyear.pm

filter: Statementstmt 100% 18 / 18 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 96.5% 28 / 29 CC 4 SCAR 10.0
CC
4
Cov
100%
isleap
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
↑ Summary
1 # $Header: /cvsroot/date-leapyear/lib/Date/Leapyear.pm,v 1.71 2002/08/30 00:00:25 rbowen Exp $
2 package Date::Leapyear;
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use vars qw(@ISA @EXPORT $VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 @ISA = qw(Exporter);
8  
9 3 @EXPORT = qw( isleap );
10 3 $VERSION = ( qw'$Revision: 1.72 $' )[1];
11  
12 =head1 NAME
13  
14 Date::Leapyear - Is a particular year a leap year?
15  
16 =head1 SYNOPSIS
17  
18 use Date::Leapyear;
19 if ( isleap(1945) ) {
20 ...
21 }
22  
23 =head1 DESCRIPTION
24  
25 Date::Leapyear exports one function - isleap - which returns 1 or 0 if
26 a year is leap, or not, respectively.
27  
28 =head1 isleap
29  
30 $true = isleap( 2004 );
31  
32 Returns 1 in a leap year, 0 otherwise.
33  
34 =cut
35  
36 761 ▶sub isleap {
Subroutine isleap: called CC=4 SCAR=13.9
Pod undocumented
37 761 my ($year) = @_;
38 761 ▶ return 1 if (( $year % 400 ) == 0 ); # 400's are leap
Branch: 1 branch
BranchTrueFalseTotal
if $year % 400 == 0 8 753 761
39 753 ▶ return 0 if (( $year % 100 ) == 0 ); # Other centuries are not
Branch: 1 branch
BranchTrueFalseTotal
if $year % 100 == 0 24 729 753
40 729 ▶ return 1 if (( $year % 4 ) == 0 ); # All other 4's are leap
Branch: 1 branch
BranchTrueFalseTotal
if $year % 4 == 0 724 5 729
41 5 return 0; # Everything else is not
42 }
43  
44 3 1;
45  
46 =head1 AUTHOR
47  
48 Rich Bowen (rbowen@rcbowen.com)
49  
50 =cut
51  
↑ Summary