Thursday, January 17, 2013

Getting into Siebel with Perl

Inspired in the post made by Jason Brazile ( I decided to get something more "Perlish" working example.

This is the first working testing that I got, basically the same example given by Jason with some interesting differences:

use strict;
use warnings;
use Siebel::COM::App::DataServer;
use feature 'say';

my $schema = {
    'Contact' => [
        'Birth Date',
        'Created By Name',
        'Email Address',
        'Fax Phone #',
        'First Name',
        'Job Title',
        'Last Name',
        'Updated By Name',
        'Work Phone #'

my $sa;

eval {

    $sa = Siebel::COM::App::DataServer->new(
            cfg         => 'C:/Siebel/8.1/Client_1/BIN/ptb/scomm.cfg',
            data_source => 'ServerDataSrcDEV',
            user        => 'foobar',
            password    => 'foobar'

    my ( $bo, $bc, $key, $field, $moreResults );


    foreach $key ( keys(%$schema) ) {

        $bo = $sa->get_bus_object($key);
        $bc = $bo->get_bus_comp($key);

        foreach $field ( @{ $schema->{$key} } ) {



        $moreResults = $bc->first_record();

        while ($moreResults) {


            foreach $field ( @{ $schema->{$key} } ) {

                printf( "%40s: %s\n", $field, $bc->get_field_value($field) );


            $moreResults = $bc->next_record();


if ($@) {

    warn $@;
    die $sa->get_last_error() if ( defined($sa) );


You might be wondering "where is the heck of Win32::OLE?". Well, the beautiful of this script is the usage of the distribution Siebel::COM, freshly available at, which provides syntax sugar and automatic error checking by using basically only Moose.

Of course there is still a lot to implement, and the code available at the SVN doesn't have yet tests neither POD documentation. But it is a good start and I'm positive that this will be available at CPAN until the end of the month (although implementing mock objects in the tests will be a problem).