ePages 7.37.0 - DE_EPAGES/Core/API/Program/Tools.pm

Package DE_EPAGES::Core::API::Program::Tools

Provides auxiliary functions for DE_EPAGES::Core::API::Program methods.

@EXPORT_OK
FindProgramFile
FindExeInPath
ProgramFileDir
Has64BitOS
GetEnvFromRegistry
AddJavaOpt

Functions

AddJavaOpt
FindExeInPath
FindProgramFile
GetEnvFromRegistry
Has64BitOS
ProgramFileDir

AddJavaOpt

adds option $Option to environment of @$Servers.

Syntax
AddJavaOpt($Option, $Servers);
Example
AddJavaOpt('-Xmx256M');
AddJavaOpt('-Xmx256M', [qw(epagesj)]);
Input
$Option (string)
java option
$Servers (array ref)
list of java servers
allowed values: epagesj, solr
default/unset: both epagesj and solr

FindExeInPath

Returns the absolute path (first occurence) of $File in $ENV{PATH}. Returns undef if the file is not found.

Syntax
$ExePath = FindExeInPath($File);
Example
$ExePath = FindExeInPath('dot.exe');
Input
$File (string)
file name
Return
$Status (string)
absolute path of the executable

FindProgramFile

Returns the absolute path (latest version) of $PathGlob in $ENV{PROGRAMFILES} For 64-bit windows returns the 64-bit exe if exists, else the 32-bit exe. $PathGlob must not have more than one '*'.

Syntax
$ExePath = FindProgramFile($PathGlob);
Example
$ExePath = FindProgramFile('Java/jdk1.7*/bin/java.exe');
Input
$PathGlob (string)
executable with glob pattern, relative to PROGRAMFILES
Return
$ExePath (string)
absolute windows path (latest version) of the executable

GetEnvFromRegistry

Returns the value of the environment variable $Env from registry

Syntax
$Value = GetEnvFromRegistry($Env);
Example
$Arch = GetEnvFromRegistry('PROCESSOR_ARCHITECTURE');
Input
$Env (string)
environment variable name
Return
$Value (integer)
environment variable value

Has64BitOS

Returns 1 if operating system is 64 bit, else 0.

Syntax
$Is64 = Has64BitOS();
Example
$ENV{PROCESSOR_ARCHITECTURE} = 'AMD64' if Has64BitOS();
Return
$Is64 (integer)
1 if 64 bit, else 0

ProgramFileDir

Returns the program files directory derived from $ENV{PROGRAMFILES} If $Bits is set, returns the 32 or 64 bit variant depending on $Bits. If $Bits is unset, returns the 64 bit variant (if exist), else 32 bit. Returns undef if the 64-bit directory is requested on a 32-bit system.

Syntax
$Directory = ProgramFileDir($Bits);
Example
$Directory = ProgramFileDir();
$Directory = ProgramFileDir(32);
Input
$Bits (integer)
bit size (undef|32|64)
Return
$Directory (string)
the program files directory