Author image Thomas Walloschke


Win32::PerlExe::Env - Get environment informations of Win32 Perl executables


This documentation refers to Win32::PerlExe::Env Version 0.02.05 $Revision: 486 $

Precautions: Alpha Release.


    use Win32::PerlExe::Env;
    $dir  = get_tmpdir();
    $dir  = get_tmpdir( 'Copyright' );
    use Win32::PerlExe::Env qw(:tmp);
    $dir  = get_tmpdir();
    $file = get_filename();
    use Win32::PerlExe::Env qw(:vars);
    my @vars =
        ( map {&$_} qw(get_build get_perl5lib get_runlib get_tool get_version) );
    use Win32::PerlExe::Env qw(:all);
    %vars = (
        map { uc $_ => eval "&get_$_" }
            map {lc} qw(tmpdir filename BUILD PERL5LIB RUNLIB TOOL VERSION)


Win32::PerlExe::Env provides special 'build-in' environment informations of Perl .exe files.

The main goal of this module version is to receive the internal temporary directory of packed Perl executables regardless of the used packer.

Additional packer specific environment informations like version, packername, etc. will be supported.

This version assists ActiveState PDK packers.


  get_tmpdir get_filename
  get_build get_perl5lib get_runlib get_tool get_version
  get_tmpdir get_filename get_build get_perl5lib get_runlib get_tool get_version


  • get_tmpdir()

  • get_tmpdir(filename)

    Get internal temporary working directory of executable.

    Hint for ActiveState PDK packer: The returned internal temporary working directory will exist only if any packed file was extracted automactically or explicitly "SEE ALSO". Therefore it is strongly recommended to test the existence of the returned directory (-d) before usage.

  • get_filename()

  • get_filename(filename)

    Get internal temporary filename of executable.

    Security hint for ActiveState packer: As a side effect the given file will be extracted into internal temporary working directory "SEE ALSO".

  • get_build

    Get the packers build number.

  • get_perl5lib

    Get the PERL5LIB environment variable. If that does not exist, it contains the value of the PERLLIB environment variable. If that one does not exists either, result is undef.

  • get_runlib

    Get the fully qualified path name to the runtime library directory.

    ActiveState specifies this by the --runlib option. If the --norunlib option is used, this variable is undef.

  • get_tool

    Get string PerlApp|PerlSvc|PerlTray ..., indicating that the currently running executable has been produced by this packer (=tool).

  • get_version

    Get the packers version number: 'major.minor.release', but not including the build number.


Running this module as part of a normal script (.pl) 'undef' results will be returned.



ActiveState PDK only:

Bound files are additional files to be included in the executable which can be extracted to an internal temporary directory or can be read directly like normal files.

Win32::PerlExe::Env supports different strategies to find out the internal temporary directory because basically inofficial PDK functions are used.

To get a stable configuration under all circumstances it is recommended that the PDK configuration files (*.perlapp, *.perlsvc or *.perltray) contain one of the following entries to define an internal default bound file:

  Bind: Win32[data=Win32]
  Bind: PerlExe[data=PerlExe]
  Bind: Env[data=Env]

These 'identifiers' will be tested internally as defaults. See EXAMPLE.

Alternatively the default bound file can be omitted if one or more user bound files were bound into the executable instead, e. g.

  Bind: Get_Info.ico[file=res\icons\Get_Info.ico] and/or
  Bind: Copyright[data=Copyright (c) 2006 Thomas Walloschke.]

This means the ':tmp' functions can be called with one of these filenames:

  get_filename( 'Get_Info.ico' );
  get_tmpdir( 'Copyright' );


See source file exe/, packer configuration file exe/Win32-PerlExe-Env.perlapp and test executable files exe/Win32-PerlExe-Env.exe and exe/Win32-PerlExe-Env.bat of this distribution.


An advantageous Win32 PerlExe Packer like Perl Development Kit [PDK].


This version examines 'ActiveState PDK executables' only (PerlApp, PerlSvc and PerlTray).

Win32::PerlExe::Env was tested only with MS Windows XP Professional (5.1.2600 Service Pack 2) and ActiveState PDK 6.0.2.

Send bug reports to my email address or use the CPAN RT system.


Perl Development Kit [PDK]


Thomas Walloschke <>.


Copyright (c) 2006 Thomas Walloschke ( All rights reserved.

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


Last changed $Date: 2006-09-09 20:48:00 +0200 (Sa, 09 Sep 2006) $.