Script.pm

Summary
Script.pm
JOINCACHE::ScriptDescribe a script, allowed to write in.
Constructors
newScript constructor.
Getters - Setters
getID
getTempDir
getOntConfDirReturns the overlayNtiff configuration’s directory
Stream methods
prepareWrite script’s header, which contains environment variables: the script ID, path to work directory, cache...
writePrint text in the script’s file, using the opened stream.
close
Export methods
exportForDebugReturns all informations about the script.

JOINCACHE::Script

Exporter
JOINCACHE::Script

Describe a script, allowed to write in.

Using

use JOINCACHE::Script;

my $objScript = JOINCACHE::Script->new({
    id => "SCRIPT_1",
    tempDir => "/home/ign/TMP/",
    commonTempDir => "/home/ign/TMP/",
    scriptDir => "/home/ign/SCRIPTS",
    executedAlone => "FALSE"
});

Attributes

idstring - Identifiant, like “SCRIPT_2”.  It used to name the file and temporary directories.
executedAloneboolean - If we know a script will be executed ALONE. it can change some working.
filePathstring - Complete absolute script file path.
tempDirstring - Directory used to write temporary images.
commonTempDirstring - Directory used to write temporary images which have to be shared between different scripts.
ontConfDirstring - Directory used to write overlayNtiff configuration files.  ontConfDir is a subdirectory of commonTempDir.
streamstream - Stream to the script file, to write in.
Summary
Constructors
newScript constructor.
Getters - Setters
getID
getTempDir
getOntConfDirReturns the overlayNtiff configuration’s directory
Stream methods
prepareWrite script’s header, which contains environment variables: the script ID, path to work directory, cache...
writePrint text in the script’s file, using the opened stream.
close
Export methods
exportForDebugReturns all informations about the script.

Constructors

new

sub new

Script constructor.  Bless an instance.  Checks parameters and creates directories.

Parameters (hash)

idstring - Identifiant, used to name the file, like ‘SCRIPT_1’.
scriptDirstring - Directory path, where to write the script.
tempDirstring - Root directory, in which own temporary directory will be created.
commonTempDirstring - Common temporary directory, to allowed scripts to share files
executedAloneboolean - Optionnal, FALSE by default.

Getters - Setters

getID

sub getID

getTempDir

sub getTempDir

getOntConfDir

sub getOntConfDir

Returns the overlayNtiff configuration’s directory

Stream methods

prepare

sub prepare

Write script’s header, which contains environment variables: the script ID, path to work directory, cache...  And functions to factorize code.

Parameters (list)

pyrDirstring - Pyramid root directory.
functionsstring - Configured bash functions, used in the script (OverlayNtiff, Cache2work...).

Example

# Variables d'environnement
SCRIPT_ID="SCRIPT_1"
COMMON_TMP_DIR="/tmp/ORTHO/COMMON"
TMP_DIR="/tmp/ORTHO/SCRIPT_1"
ONT_CONF_DIR="/tmp/ORTHO/COMMON/overlayNtiff"
PYR_DIR="/home/ign/PYR/ORTHO"

write

sub write

Print text in the script’s file, using the opened stream.

Parameters (list)

textstring - Text to write in file.

close

sub close

Export methods

exportForDebug

sub exportForDebug

Returns all informations about the script.  Useful for debug.

Example

Object JOINCACHE::Script :
    ID : SCRIPT_2
    Will NOT be executed alone
    Script path : /home/IGN/SCRIPTS/SCRIPT_2.sh
    Temporary directory : /home/IGN/TEMP/SCRIPT_2
    Common temporary directory : /home/IGN/TEMP/COMMON
    OverlayNtiff configuration directory : /home/IGN/TEMP/COMMON/overlayNtiff
sub new
Script constructor.
sub getID
sub getTempDir
sub getOntConfDir
Returns the overlayNtiff configuration’s directory
sub prepare
Write script’s header, which contains environment variables: the script ID, path to work directory, cache...
sub write
Print text in the script’s file, using the opened stream.
sub close
sub exportForDebug
Returns all informations about the script.
Close