Rene Schickbauer


Maplat::Helpers::BuildNum - get the build number of the application


  use Maplat::Helpers::BuildNum;
  my $buildnum = readBuildNum();

  my $buildnum = readBuildNum("buildnum", 1); # when running compiled

  my $buildnum = calcBuildNum();


This module is used in conjunction with compiled perl scripts (e.g. when compiled with ActiveState tools or similar).

It's very usefull when upgrading a server to know the build numbers (see below) of a compiled perl program. When used in a scripted environment, the build number is generated on the fly.


Calculates a build number, consisting of the build date and the hostname of the computer used.


Returns the build number.

The build number consists of the form


Where date is the build date and time (or date/time of the first call to the function when running non-compiled), hostname the hostname of the computer the binary was build.

"X" is either one of R ("runtime", interpreted script), C (compiled) or "G" (compiled script but unable to read the compiled-in build number, so build-number is generated at runtime).

The function takes two optional arguments, $filename and $iscompiled:

  my $buildnum = readBuildNum("buildnum", 1);

This is used when compiled with the ActiveState PDK and must be set depending on your development environment. The $filename is the name of the bound file, consisting of one line, the build number.


Calculates a build number, see "Adding an automatic build number to your program"

Adding an automatic build number to your program

To work correctly, building should be done with a perl script, something like this:

  use Maplat::Helpers::BuildNum;
  my $cmd = "perlapp " .
            " --icon " . $opts{icon} .
            " --norunlib " .
            " --nocompress " .
            " --nologo " .
            " --manifest " . $opts{mf} .
            " --clean " .
            " --trim " . join(";", @trimmodules) . " " .
            " --force " .
            " --bind buildnum[data=" . calcBuildNum . "] " .
            " --exe " . $opts{exe} .
            " " . $opts{main};

Then, at runtime, you can get the current build number:

  use Maplat::Helpers::BuildNum;
  our $isCompiled = 0;
  if(defined($PerlApp::VERSION)) {
    $isCompiled = 1;
  my $buildnum = readBuildNum("buildnum", $isCompiled);


Rene Schickbauer, <>


Copyright (C) 2008-2011 by Rene Schickbauer

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.