Lire::Program(3pm)

Lire::Program3pm

Lire's programs common infrastructure.

Usage

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: ", $! );

Overview

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.

Version

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

Releases

7 releases since Debian 3.0 (Woody); the text changed 6 times.

  1. 3.0
  2. 3.1
  3. 4.0
  4. 5.0
  5. 6.0
  6. 7
  7. Arch

Author

  Francis J. Lacoste <[email protected]>

From lire 2.1.1-8 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.