File: utils.pm

package info (click to toggle)
libgd-graph-perl 1.56~ds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 788 kB
  • sloc: perl: 5,098; makefile: 52
file content (49 lines) | stat: -rw-r--r-- 1,246 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#==========================================================================
#              Copyright (c) 1995-1999 Martien Verbruggen
#--------------------------------------------------------------------------
#
#   Name:
#       GD::Graph::utils.pm
#
#   Description:
#       Package of general utilities.
#
# $Id: utils.pm,v 1.7 2005/12/14 04:13:36 ben Exp $
#
#==========================================================================
 
package GD::Graph::utils;

($GD::Graph::utils::VERSION) = '$Revision: 1.7 $' =~ /\s([\d.]+)/;

use strict;

use vars qw( @EXPORT_OK %EXPORT_TAGS );
require Exporter;

@GD::Graph::utils::ISA = qw( Exporter );
 
@EXPORT_OK = qw(_max _min _round);
%EXPORT_TAGS = (all => [qw(_max _min _round)]);

sub _max { 
    my ($a, $b) = @_; 
    return undef    if (!defined($a) and !defined($b));
    return $a       if (!defined($b));
    return $b       if (!defined($a));
    ( $a >= $b ) ? $a : $b; 
}

sub _min { 
    my ($a, $b) = @_; 
    return undef    if (!defined($a) and !defined($b));
    return $a       if (!defined($b));
    return $b       if (!defined($a));
    ( $a <= $b ) ? $a : $b; 
}

sub _round { sprintf "%.0f", shift }

sub version { $GD::Graph::utils::VERSION }

"Just another true value";