NAME
BusinessHours - An object that calculates business days and hours
SYNOPSIS
use BusinessHours;
use DateTime;
my $datetime1=DateTime->new(year=>2007,month=>10,day=>15);
my $datetime2 = DateTime->now;
my $testing = BusinessHours->new(datetime1=>$datetime1,
datetime2=>$datetime2,
worktiming=>[9,18], # 9 am to 6 om
weekends=>[6,7], #saturday , sunday
holidayfile=>'holidaylist' #holidaylist is a text file
#with each date in a new line
#in the format dd-mm-yyyy
);
print $testing->getdays."\n"; # the total business days
print $testing->gethours; # the total business hours
DESCRIPTION
BusinessHours a class for caculating the business hours between two DateTime objects.It can be useful in situations like escalation where an action has to happen after a certain number of business hours.
USAGE
Create an instance of the class with the two required datetime objects. and use the methods to get the business hours or days.
Constructors
new( ... )
This class method accepts the following parameters in the hash format.
datetime1 => Starting Date datetime2 => Ending Date worktimings => A list reference with two values.Starting and ending hour of the day. Defaults to [9,18] weekends => A list reference with values of the days that must be considered as non-working in a week.Defaults to [6,7] - Saturday , Sunday. holidayfile => The name of a file from which predefined holidays can be excluded from business days /hours calculation. Defaults to no file.
Methods
This class has two methods.
getdays
Returns the number of business days
gethours
Returns the number of business hours.
AUTHOR
Antano Solar John<solar345@gmail.com>
COPYRIGHT
Copyright (c) 2007 Antano Solar John. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 225:
You forgot a '=back' before '=head3'