26 Creating Client Applications by Using Perl PCM

This chapter introduces the Perl extension to the Oracle Communications Billing and Revenue Management (BRM) Portal Communications Module (PCM) library.

For information on using the functions in the Perl PCMIF library, see "Perl Extensions to the PCM Libraries" in BRM Developer's Reference.

About the Perl API

The Perl extension to the PCM library, pcmif, allows you to use Perl scripts to perform the following PCM operations:

  • Connect to PCM.

  • Perform PCM opcode operations, such as creating an object, searching for objects, deleting an object.

  • Convert flists (field lists) between text and binary formats.

  • Generate error reports.

For more information, see the following documents:

  • For a description of the Application Programming Interface (API), see "Perl Extensions to the PCM Libraries" in BRM Developer's Reference.

  • For sample scripts, see "Example Perl Scripts" in BRM Developer's Reference.

  • For the latest information on the Perl extension, see pod2text (text format) or pod2html (HTML format) in the BRM_SDK_Home/lib/pcmif.pm.

Differences between the Perl API and the C API

The API functions in pcmif are wrappers for a subset of the underlying C functions. You can use the Perl API functions to perform any BRM PCM opcode operation.

The pcmif API functions use the following naming conventions:

  • If the C function and its corresponding Perl function use exactly the same arguments, they have the same name.

  • If the arguments are different, the Perl equivalent to the C function pin_function() is named pin_perl_function() to differentiate them.

Guidelines for Using the Pcmif Module

To perform PCM operations by using Perl scripts, follow these guidelines:

  • Make sure your scripts include the following information:

    The path to the Perl binaries in the first line:

    #!/BRM_SDK_Home/perl/bin/perl; 
      
    

    The Perl module to use:

    use pcmif;
      
    
  • Use Perl 5.0004, included with BRM.

    If you use a different version of Perl, make sure you specify the path to the pcmif files in the Perl command line or by including the use lib <path> line in the beginning of your Perl scripts.

  • Add the class prefix pcmif:: to the functions, which specifies that these functions are from the pcmif package. For example:

    pcmif::pcm_perl_new_ebuf();
      
    
  • Make sure you use the PerlScriptName.bat instead of the PerlScriptName.pl.

Performing PCM Operations

To write Perl scripts that perform BRM operations, follow these guidelines:

  • Connect to PCM by opening a PCM connection and a PCM context to the BRM.

    See "Connection Functions" in BRM Developer's Reference for a description of the API.

    If your custom application supports multiple database schemas, you must use the database number returned by PCM_CONNECT() or PCM_CONTEXT_OPEN() for all transactions within the context you open. For more information, see "Maintaining Transactional Integrity".

  • Check for errors after each action.

    See "Error-Handling Functions" in BRM Developer's Reference for a description of the API.

  • Convert flists between text and binary formats:

    • Convert strings that you create in your Perl script to flist format before performing PCM operations.

      For example, if you use a "here" document to assign an flist string to a variable in your Perl scripts, convert the variable to flist format before searching for an object by using PCM_OP_SEARCH.

    • Convert flists to string format before using them in Perl functions. For example, to pass an flist as input to Perl functions such as string matching, first convert the flist to a string.

      See "Flist Conversion Functions" in BRM Developer's Reference for a description of the flist conversion functions.

    • Perform the PCM operations.

      See "Error-Handling Functions" in BRM Developer's Reference for a description of the API.

  • Delete the flists and error buffers you no longer need.

    See "Error-Handling Functions" and "Flist Conversion Functions" in BRM Developer's Reference for a description of the functions to use.

  • Disconnect from PCM by closing the PCM context.

    See "Connection Functions" in BRM Developer's Reference for a description of the API.