File Coverage

blib/lib/Data/OpeningHours.pm
Criterion Covered Total %
statement 15 17 88.2
branch n/a
condition n/a
subroutine 5 6 83.3
pod 0 1 0.0
total 20 24 83.3


line stmt bran cond sub pod time code
1 2     2   100536 use strict;
  2         6  
  2         120  
2 2     2   13 use warnings;
  2         6  
  2         93  
3             package Data::OpeningHours;
4 2     2   12 use strict;
  2         9  
  2         58  
5 2     2   69 use 5.008_005;
  2         6  
  2         124  
6             our $VERSION = '0.4.2';
7              
8 2     2   1996 use parent 'Exporter';
  2         704  
  2         12  
9              
10             our @EXPORT_OK = qw/is_open/;
11              
12             sub is_open {
13 0     0 0   my ($calendar, $now) = @_;
14 0           return $calendar->is_open($now);
15             }
16              
17             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 Epeter@stuifzand.euE
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