The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

SYNOPSYS

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

DESCRIPTION

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

The main goal of this module version ("VERSION AND DATE") is to get the internal temporary directory of packed Perl executables ("[PDK] BOUND FILES") regardless of the used packer.

This version supports ActiveState PDK packer (LIMITS and "SEE ALSO").

EXPORTS

:DEFAULT
  get_tmpdir
:tmp
  get_tmpdir get_filename
:vars
  get_build get_perl5lib get_runlib get_tool get_version
:all
  get_tmpdir get_filename get_build get_perl5lib get_runlib get_tool get_version

FUNCTIONS

  • 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 automactically or explicitly extracted "SEE ALSO". Therefore it is strongly recommended to test the existence of the 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 (PerlApp, ...) 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 Perl... (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.

[PDK] BOUND FILES

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' );

EXAMPLE

See source exe/Win32-PerlExe-Env.pl, packer config exe/Win32-PerlExe-Env.perlapp and executable exe/Win32-PerlExe-Env.exe of this installation.

The executable was packed with ActiveState PDK PerlApp 6.0.2. The size was optimized with packer options set to Make dependent executable and Exclude perl58.dll from executable. To run this executable properly a Win32 Perl Distribution and the recent Win32::PerlExe::Env must be installed.

LIMITS

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

Precautions: This is an alpha release.

Win32::PerlExe::Env was tested under Win32 XP SR2 and ActiveState PDK 6.0.2.

I would be pleased if anyone could send me more test identifiers for other .exe distributions ( Ref. in source: -- PerlExe ... (assumed code :) ) ).

SEE ALSO

Perl Development Kit [PDK] http://www.activestate.com/Products/Perl_Dev_Kit/?mp=1

AUTHOR

Thomas Walloschke <thw@cpan.org>.

COPYRIGHT AND LICENSE

Copyright (c) 2006 Thomas Walloschke (thw@cpan.org).

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.

VERSION AND DATE

This is Version 0.1.3 $Revision: 397 $

Precautions: alpha release.

Last changed $Date: 2006-08-25 19:19:23 +0200 (Fr, 25 Aug 2006) $.

6 POD Errors

The following errors were encountered while parsing the POD:

Around line 189:

'=item' outside of any '=over'

Around line 214:

You forgot a '=back' before '=head1'

Around line 227:

'=item' outside of any '=over'

Around line 243:

You forgot a '=back' before '=head1'

Around line 245:

'=item' outside of any '=over'

Around line 292:

You forgot a '=back' before '=head1'