man Lire::Program () - Lire's programs common infrastructure.
NAME
Lire::Program - Lire's programs common infrastructure.
SYNOPSIS
Any program:
use Lire::Program qw/ :msg /;
lr_info( "doing stuff " ); lr_debug( "debugging information" ); lr_warn( "encountered unexpected value: ", $value ); open( CFGFILE, "my.conf" ) or lr_err( "open error: ", $! );
DESCRIPTION
This module should be used by all Lire programs (at least the Perl ones :-).
It includes:
- 1.
- Common behavior for good integration in the Lire suite. (Output of performance information and other stuff).
- 2.
- Functions for portability.
- 3.
- Logging functions
COMMON BEHAVIOR FOR LIRE PROGRAMS
When you use the Lire::Program module, you make sure that your program will behave correctly in the Lire tool chain. This module will install BEGIN and END blocks to comply with Lire's policy.
- 1.
-
Only messages in the proper logging format
I<superservice> I<service> I<lr_id> I<program> I<level> I<msg>
should be output. This module will install a __WARN__ signal handler that makes sure that all modules that use warn to output messages are rewritten in the proper format. See also lr_run(1). - 2.
- All programs should start by a CWinfo message which logs their arguments. This module takes care of this.
- 3.
-
All programs should end by printing CWinfo messages with performance
statistics and the message 'ended'. Using this module takes care of
this. At the end of your program the following will be output
(stripped off the common information):
memory stats: vsize=10688K rss=9380K majflt=406 elapsed time in seconds real=9 user=8.72 system=0.06 stopped
The memory profiling information will only be output on platforms running the Linux kernel.
COMMON VARIABLES
As a convenience, you can import in your namespace using the :env tag some variables common to all Lire programs. (Note that you can also use those variables without importing them by prefixing the variables with the Lire::Program:: namespace.)
- $PROG
- The name of your program (that's the value of CW$0 without the directory path).
- $LR_SUPERSERVICE
- The superservice which you are processing, or CWall if this information isn't available.
- $LR_SERVICE
- The service which you are processing, or CWall if this information isn't specified.
- $LR_ID
- That's the job identifier. It should be shared by all commands in a Lire job. This is the value UNSET when none was specified.
- $LR_TAG
-
That's the prefix to all log messages. Should correspond to
$LR_SUPERSERVICE $LR_SERVICE $LR_ID $PROG
LOGGING FUNCTIONS
The logging functions are now part of the Lire::Logger module. Consult Lire::Logger(3pm) for more information. The old names are still exported from this module by using the ':msg' tag.
DLF CONVERTERS FUNCTIONS
The DLF converter API is now defined in Lire::DlfConverter(3pm). The Lire::OldDlfAdapter(3pm) can be used to work with old-style DLF Converters.
SEE ALSO
AUTHOR
Francis J. Lacoste <flacoste@logreport.org>
VERSION
$Id: Program.pm,v 1.34 2004/05/25 00:54:53 wsourdeau Exp $
COPYRIGHT
Copyright (C) 2001 Stichting LogReport Foundation LogReport@LogReport.org
This file is part of Lire.
Lire 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 program 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 program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html or write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.