Resource Management and Oracle® Solaris Zones Developer's Guide

Exit Print View

Updated: July 2014
 
 

Benefits of Using the Perl Interface to libexacct

The Perl extensions to extended accounting provide a Perl interface to the underlying libexacct(3LIB) API and offer the following enhancements.

  • Full equivalence to C API provide a Perl interface that is functionally equivalent to the underlying C API.

    The interface provides a mechanism for accessing exacct files that does not require C coding. All the functionality that is available from C is also available by using the Perl interface.

  • Ease of use.

    Data obtained from the underlying C API is presented as Perl data types. Perl data types ease access to the data and remove the need for buffer pack and unpack operations.

  • Automated memory management.

    The C API requires that the programmer take responsibility for managing memory when accessing exacct files. Memory management takes the form of passing the appropriate flags to functions, such as ea_unpack_object(3EXACCT), and explicitly allocating buffers to pass to the API. The Perl API removes these requirements, as all memory management is performed by the Perl library.

  • Prevent incorrect use of API.

    The ea_object_t structure provides the in-memory representation of exacct records. The ea_object_t structure is a union type that is used for manipulating both Group and Item records. As a result, an incorrectly typed structure can be passed to some of the API functions. The addition of a class hierarchy prevents this type of programming error.