The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Business::SLA -

SYNOPSIS

  use Business::SLA;

  my $SLAObj = Business::SLA->new(
    BusinessHours     => new Business::Hours,
    InHoursDefault    => '2 real hours',
    OutOfHoursDefault => '1 business hour',
  );

  # or set/change options later
  $SLAObj->SetBusinessHours( new Business::Hours );
  $SLAObj->SetInHoursDefault('2 real hours');
  $SLAObj->SetOutOfHoursDefault('1 business hour');

  # add service levels
  $SLAObj->Add( '2 real hours' => RealMinutes => 2*60 );
  $SLAObj->Add( '1 business hour' => BusinessMinutes => 60 );
  $SLAObj->Add( 'next business minute' );

DESCRIPTION

This module is a simple tool for handling operations related to Service Level Agreements.

METHODS

new

Creates and returns new Business::SLA object.

Takes a hash with values of "BusinessHours", "InHoursDefault" and "OutOfHoursDefault" options. You can ommit these options and set them latter using methods (see below).

SetBusinessHours

Sets a Business::Hours object to use for calculations. This module works without this option, but looses most functionality you can get with it.

It's possible use any object that API-compatible with Business::Hours.

BusinessHours

Returns the current Business::Hours object or undef if it's not set.

SetInHoursDefault

Sets the default service level for times inside of business hours.

Takes a service level.

InHoursDefault

Returns the default service level for times inside of business hours.

SetOutOfHoursDefault

Sets the default service level for times outside of business hours.

Takes a service level.

Note that "BusinessHours" are used for calculations, so this option makes not much sense without business hours have been set.

OutOfHoursDefault

Returns the default service level for times outside of business hours.

IsInHours

Returns true if the date passed in is in business hours, and false otherwise. If no business hours have been set, returns true by default.

Takes a date in Unix time format (number of seconds since the epoch).

SLA

Returns the default servise level for the specified time.

Takes a date in Unix time format (number of seconds since the epoch).

Add

Adds or replaces a service level definition.

Takes a service level and a hash with agreements. In the hash you can define BusinessMinutes, RealMinutes and StartImmediately boolean option.

AddRealMinutes

The number of real minutes to add for the specified SLA.

Takes a service level.

AddBusinessMinutes

The number of business minutes to add for the specified SLA.

Takes a service level.

StartImmediately

Returns true if things should be started immediately for a service level. See also Add and "Starts".

Takes the service level.

Starts

Returns the starting time, given a date and a service level.

If the service level's been defined as StartImmediately then returns the same date, as well this also happens if business hours are not set.

Takes a date in Unix time format (number of seconds since the epoch) and a service level.

Due

Returns the due time, given an SLA and a date.

Takes a date in Unix time format (number of seconds since the epoch) and the hash key for the SLA.

SUPPORT

Send email to bug-business-sla@rt.cpan.org

AUTHOR

    Linda Julien
    Best Practical Solutions, LLC 
    leira@bestpractical.com
    http://www.bestpractical.com

COPYRIGHT

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.

SEE ALSO

perl(1), Business::Hours.