Foorum::Release - Utils for Release


Foorum documentation Contained in the Foorum distribution.

Index


Code Index:

NAME

Top

Foorum::Release - Utils for Release

FUNCTIONS

Top

get_version

get the recent $VERSION for Foorum

bump_up_version

return the value of $VERSION++

AUTHOR

Top

Fayland Lam <fayland at gmail.com>


Foorum documentation Contained in the Foorum distribution.

package Foorum::Release;

use strict;
use warnings;

our $VERSION = '1.001000';

use base 'Exporter';
use vars qw/@EXPORT_OK/;
@EXPORT_OK = qw/get_version bump_up_version/;

sub get_version {
    return $VERSION;
}

sub bump_up_version {
    my ($version) = shift;

    $version = get_version() unless ( defined $version );

    # like 0.003001
    my ( $v1, $v2, $v3 ) = ( $version =~ /^(\d+)\.00(\d)00(\d)$/ );
    my $num = $v1 * 100 + $v2 * 10 + $v3;
    $num++;
    $v3 = chop($num);
    $v2 = chop($num);
    $v1 = $num || 0;
    return sprintf( "%d.%03d%03d", $v1, $v2, $v3 );
}

1;
__END__