Lire::Program(3) 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 "info" message which logs their arguments. This module takes care of this.
3.
All programs should end by printing "info" 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 $0 without the directory path).
$LR_SUPERSERVICE
The superservice which you are processing, or "all" if this information isn't available.
$LR_SERVICE
The service which you are processing, or "all" 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.

AUTHOR

  Francis J. Lacoste <[email protected]>

VERSION

$Id: Program.pm,v 1.35 2006/07/23 13:16:29 vanbaal Exp $

COPYRIGHT

Copyright (C) 2001 Stichting LogReport Foundation [email protected]

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.