The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Logic::Tools - The great new Logic::Tools!

VERSION

SYNOPSIS

    my $tools=Logic::Tools->new(config_file =>  '/etc/config/config.ini.ini',
                                lock_file   =>  $lock_file,
                                runas_user  =>  $runas_user,
                                logfile     =>  '/var/log/log.log',
                                syslog_name =>  'program_name');

    #logfile => 'path_to_file' - logging in to file
    #logfile => 'Syslog' - logging in to syslog
    #logfile => 'Stdout' - logging in to stdout
    #syslog_name =>  'program_name' or default $0
    
    
    my $db_host=$tools->read_config( 'config', 'db_host');
    
    #проверка не запущен ли этот процесс
    $tools->check_proc();
    
    #запускаем как демон
    $tools->start_daemon();
    
    $tools->logprint("info","диалог:  $state $callid $from_uri $to_uri ");
    

EXPORT

SUBROUTINES/METHODS

constructor

new ( %ARGS )
config_file

Путь до файла с конфигами на что-либо

lock_file

Файл для блокировки при запуске приложения как демона, в этот файл записываедся текущий pid процесса

runas_user

пользователь под которым запускать приложение

logfile

файл для сохранения лога

METHODS

read_config ( SECTION, PARAM )

метод для чтения параметров из конфигурационного файла config_file

возвращает занчение параметра указанной секции

SECTION - конфиг файл состоит из секций, в квадратных скобках указано название секции
PARAM - внутри секции параметрам соответствует значение
check_proc()

проверяет процесс по lock_file на то что он уже запущен, если не запущен возвращает 1, если запущен выдает ошибку в STDERR и завершается

logprint ( LOGLEVEL, MESSAGE )

записывает сообщение MESSAGE в лог файл logfile, с уровнем LOGLEVEL

    item LOGLEVEL - может принимать следующие значения:

      trace debug info notice warning error critical alert emergency

start_daemon

запускает процесс как демон под пользователем runas_user, создает файл блокировки lock_file

supervisor_start_daemon

запускает процесс как демон под пользователем runas_user, создает файл блокировки lock_file, посредством программы supervisord

AUTHOR

lagutas, <lagutas at gmail.com>

BUGS

Please report any bugs or feature requests to bug-logic-tools at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Logic-Tools. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

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

    perldoc Logic::Tools

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2013 lagutas.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 121:

'=item' outside of any '=over'