OpeningHours.pm

filter: Statementstmt 89.4% 17 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 84.6% 22 / 26 CC 1 SCAR 1.5
CC
1
Cov
89%
is_open
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« OpeningHours/Hours.pm ↑ Summary
1 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 package Data::OpeningHours;
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use 5.008_005;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 our $VERSION = '0.4.2';
7  
8 2 ▶use parent 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 our @EXPORT_OK = qw/is_open/;
11  
12 0 ▶sub is_open {
Subroutine is_open: not called CC=1 SCAR=6.9
Pod undocumented
13 0 my ($calendar, $now) = @_;
14 0 return $calendar->is_open($now);
15 }
16  
17 2 1;
18  
19 =head1 NAME
20  
21 Data::OpeningHours - Is a shop is open or closed at this moment?
22  
23 =head1 SYNOPSYS
24  
25 use DateTime;
26 use Data::OpeningHours 'is_open';
27 use Data::OpeningHours::Calendar;
28  
29 my $cal = Data::OpeningHours::Calendar->new();
30 $cal->set_week_day(1, [['13:00','18:00']]); # monday
31 $cal->set_week_day(2, [['09:00','18:00']]);
32 $cal->set_week_day(3, [['09:00','18:00']]);
33 $cal->set_week_day(4, [['09:00','18:00']]);
34 $cal->set_week_day(5, [['09:00','21:00']]);
35 $cal->set_week_day(6, [['09:00','17:00']]);
36 $cal->set_week_day(7, []);
37 $cal->set_special_day('2012-01-01', []);
38 is_open($cal, DateTime->now());
39  
40 =head1 DESCRIPTION
41  
42 Data::OpeningHours helps you create a widget that shows when a shop is open or
43 closed.
44  
45 =head1 AUTHOR
46  
47 Peter Stuifzand E<lt>peter@stuifzand.euE<gt>
48  
49 =head1 COPYRIGHT
50  
51 Copyright 2013 - Peter Stuifzand
52  
53 =head1 LICENSE
54  
55 This library is free software; you can redistribute it and/or modify
56 it under the same terms as Perl itself.
57  
58 =cut
59  
« OpeningHours/Hours.pm ↑ Summary