[Rt-commit] [svn] r1574 - Business-SLA/trunk/lib/Business

leira at pallas.eruditorum.org leira at pallas.eruditorum.org
Wed Sep 29 00:35:10 EDT 2004


Author: leira
Date: Wed Sep 29 00:35:10 2004
New Revision: 1574

Modified:
   Business-SLA/trunk/lib/Business/SLA.pm
Log:
Better handling of undefined values.


Modified: Business-SLA/trunk/lib/Business/SLA.pm
==============================================================================
--- Business-SLA/trunk/lib/Business/SLA.pm	(original)
+++ Business-SLA/trunk/lib/Business/SLA.pm	Wed Sep 29 00:35:10 2004
@@ -15,6 +15,79 @@
 	%EXPORT_TAGS = ();
 }
 
+########################################### main pod documentation begin ##
+
+=head1 NAME
+
+Business::SLA - 
+
+=head1 SYNOPSIS
+
+  use Business::SLA;
+
+  my $SLAObj = new Business::SLA;
+
+  $SLAObj->Add('2 real hours', { 'RealMinutes' => 120, 
+				 'BusinessMinutes' => undef, });
+
+  $SLAObj->Add('1 business hour', { 'RealMinutes' => 0, 
+				    'BusinessMinutes' => 60, });
+
+  $SLAObj->Add('next business minute', { 'RealMinutes' => 0, 
+					  'BusinessMinutes' => 0, });
+
+  $SLAObj->SetInHoursDefault($RT::_RTIR_SLA_inhours_default);
+  $SLAObj->SetOutOfHoursDefault($RT::_RTIR_SLA_outofhours_default);
+
+  my $hours = Business::Hours->new();    
+  # Get a Set::IntSpan of all the business hours in the next week.
+  # use the default business hours of 9am to 6pm localtime.
+  $hours->business_hours_in_timespan(Start => time(), End => time()+(86400*7));
+
+=head1 DESCRIPTION
+
+This module is a simple tool for calculating business hours in a time period. 
+Over time, additional functionality will be added to make it easy to calculate the number of
+business hours between arbitrary dates. 
+
+
+=head1 USAGE
+
+
+
+=head1 BUGS
+
+Yes
+
+=head1 SUPPORT
+
+Send email  to bug-business-hours at rt.cpan.org
+
+
+=head1 AUTHOR
+
+    Jesse Vincent
+    Best Practical Solutions, LLC 
+    jesse at cpan.org
+    http://www.bestpractical.com
+
+=head1 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.
+
+
+=head1 SEE ALSO
+
+perl(1).
+
+=cut
+
+############################################# main pod documentation end ##
+
 sub new {
 	my $class = shift;
 
@@ -131,6 +204,8 @@
     my $self = shift;
     my $sla = shift;
 
+    return undef unless defined $sla;
+
     if (!$self->BusinessHours) {
 	return undef;
     }
@@ -170,8 +245,6 @@
 	my $bh = $self->BusinessHours();
 	$due = $bh->add_seconds($due, 
 				60 * $self->AddBusinessMinutes($sla));
-    } else {
-	$due += (60 * $self->AddBusinessMinutes($sla));
     }
 
     $due += (60 * $self->AddRealMinutes($sla));


More information about the Rt-commit mailing list