NAME

CAD::Firemen::Common - Shared functions used by other scripts from the Firemen module.

VERSION

version 0.7.2

METHODS

strip

Strips out whitespaces at the beginning and the end of the given string. It also removes double whitespaces.

untaint

to untaint the string, it strip outs any escape sequences (without \n), to make the string more secure (taint mode)

print2ColsRightAligned

Prints the string within the first parameter on the far left of the screen. The second paremeter is printed on the far right of the screen in the color of optional third parameter. See Term::ANSIColor for the names of the colors.

testPassed

Prints the content of the first parameter on the far left screen side and "PASSED" in green on the far right.

testFailed

Prints the content of the first parameter on the far right side and "FAILED" in red on the far right.

maxLength

Returns the lenght of the longest string within the given array as first parameter.

printColored

Prints the given text in the given color. The main reason to use this function is to use Win32::Console within this module.

printBlock

Prints a text block with an specified indentation.

buildStatistic

Builds a bar of = to display a percentage value of the ratio between $value and $max.

getInstallationPath

Method parses $ENV{PATH} and tries to filter out all Firemen related paths. Afterwards, if more than one is found, the user can select which one he wants to use. This one is returned than.

The returned path DOES NOT ends with a slash!

getInstallationConfigCdb

Uses getInstallationConfigPath() to return the full path to the related config.cdb. You may specify the installation path to get the related config.pro. If not given, it uses getInstallationPath() to guess or ask one.

getInstallationConfigPro

Uses getInstallationConfigPath() to return the full path to the related config.pro. You may specify the installation path to get the related config.pro. If not given, it uses getInstallationPath() to guess or ask one.

sharedDir

Returns the path to the shared directory where all modules and scripts of this distribution places their files.

If it does not exists, it creates it.

installationId

Compuates an installation identifier out of the creo installation path. This ID is used e. g. to create the database name.

dbConnect

Creates a connection to the database and returns the reference to the DBI object or 0 if an error occurs. If the database does not exists an empty database file is created.

If you want to insert data, make sure that you use the commit function, since AutoCommit is disabled.

The database layout is described in fm_create_help.

loadSettings

Loads the settings from config file and returns a reference to the hash.

Most possible settings are explained at CAD::Firemen (Use perldoc CAD::Firemen).

saveSettings

Saves the Hash, which reference is given into the config file.

cleanSvn

Method to delete all .svn directories borrowed from http://snipplr.com/view/27050/ with small change (introduced rmtree)

_settingsFile FOR INTERNAL USE ONLY!

Returns the file path to the config file. Use loadSettings() and saveSettings() to get and store settings

_terminalWidth FOR INTERNAL USE ONLY!

Returns the terminal width.

AUTHOR

Joachim Langenbach <langenbach@imw.tu-clausthal.de>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by TU Clausthal, Institut fuer Maschinenwesen.

This is free software, licensed under:

  The GNU General Public License, Version 2, June 1991