ManaTools::Shared

Section: User Contributed Perl Documentation (3)
Updated: 2017-07-06
Page Index
 

NAME

ManaTools::Shared - ManaTools::Shared contains all the shared routines
                     needed by ManaTools and modules  

SYNOPSIS

 

DESCRIPTION

This module collects all the routines shared between ManaTools and its modules.  

EXPORT

    trim
    md5sum
    pathList2hash
    distName
    apcat
    inArray
    disable_x_screensaver
    enable_x_screensaver
    isProcessRunning
    custom_locale_dir
    devel_mode
    command_line
    help_requested

 

SUPPORT

You can find documentation for this module with the perldoc command:

    perldoc ManaTools::Shared

 

AUTHOR

Angelo Naselli <anaselli@linux.it>  

COPYRIGHT and LICENSE

Copyright (C) 2013, Angelo Naselli. Copyright (C) 2014, Matteo Pasotti.

This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.

This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this file. If not, see <http://www.gnu.org/licenses/>.  

FUNCTIONS

 

apcat

PARAMETERS

    $filename the name of the file to read

OUTPUT

    depending from the context it returns the content
    of the file as an array or a string

DESCRIPTION

    This function return the content of $filename or false/0
    if it fails

 

distName

OUTPUT

    $distname: name of the distributed package

DESCRIPTION

    This function return the distname, useful to retrieve data
    with File::ShareDir::dist_file and must be the same as into
    Makefile.PL (e.g. manatools)

 

trim

INPUT

    $st: String to be trimmed

OUTPUT

    $st: trimmed string

DESCRIPTION

This function trim the given string.  

inArray

INPUT

    $item: item to search
    $arr:  array container

OUTPUT

    true: if the array contains the item

DESCRIPTION

This method returns if an item is into the array container  

md5sum

INPUT

    $filename: file for md5 calculation

OUTPUT

    md5 sum

DESCRIPTION

    compute MD5 for the given file

 

pathList2hash

INPUT

    $param : HASH ref containing
            paths     =>  ARRAY of string containing path like strings
            separator => item separator inside a single path
                        (default separator is /)

OUTPUT

    \%tree: HASH reference containing the same structur passed as ARRAY
            in a tree view form, leaves are undef.

DESCRIPTION

    This function return a tree representation of the given array.

 

disable_x_screensaver

DESCRIPTION

    if exists /usr/bin/xset disable screensaver

 

enable_x_screensaver

DESCRIPTION

    if exists /usr/bin/xset enables screensaver

 

isProcessRunning

INPUT

    $name: Process name
    $o_user: user who the process belongs to

OUTPUT

    $pid: process identifier

DESCRIPTION

    Function returns the process identifier if the given
    process is running

 

command_line

OUTPUT

    $cmdline: given command line

DESCRIPTION

    returns the command line meant as yui::YCommandLine object

 

custom_locale_dir

OUTPUT

    locale_dir: custom locale directory or undef

DESCRIPTION

    returns the custom locale directory if given by
    command line using "--locales-dir path" or undef

 

devel_mode

OUTPUT

    boolean: 1 if --devel-mode is passed to command line, 0
               otherwhise

DESCRIPTION

    returns 1 if "--devel-mode" is passed to command line,
    modules should check this value to work in developer mode

 

help_requested

OUTPUT

    boolean: 1 if "--help" or "-h" is passed to command line, 0
               otherwhise

DESCRIPTION

    returns 1 if "--help" or "-h" is passed to command line,
    modules should check this value to work accordingly


 

Index

NAME
SYNOPSIS
DESCRIPTION
EXPORT
SUPPORT
AUTHOR
COPYRIGHT and LICENSE
FUNCTIONS
apcat
distName
trim
inArray
md5sum
pathList2hash
disable_x_screensaver
enable_x_screensaver
isProcessRunning
command_line
custom_locale_dir
devel_mode
help_requested