Using Perl with Caché
The Caché Perl Binding
[Home] [Back] [Next]
InterSystems: The power behind what matters   

The Caché Perl binding provides a simple, direct way to manipulate Caché objects from within a Perl application. It allows Perl programs to establish a connection to a database on Caché, create and open objects in the database, manipulate object properties, save objects, run methods on objects, and run queries. All Caché datatypes are supported.

The Perl binding offers complete support for object database persistence, including concurrency and transaction control. In addition, there is a sophisticated data caching scheme to minimize network traffic when the Caché server and the Perl applications are located on separate machines.
This document assumes a prior understanding of Perl and the standard Perl modules. Caché does not include a Perl interpreter or development environment.
Perl Binding Architecture
The Caché Perl binding gives Perl applications a way to interoperate with objects contained within a Caché server. The Perl binding consists of the following components:
The basic mechanism works as follows:
Quick Start
Here are examples of a few basic functions that make up the core of the Perl binding:
Installation and Configuration
The standard Caché installation places all files required for Caché Perl binding in <cachesys>/dev/perl. (For the location of <cachesys> on your system, see Default Caché Installation Directory in the Caché Installation Guide). You should be able to run any of the Perl sample programs after performing the following installation procedures.
Perl Client Requirements
Caché provides client-side Perl support through the Intersys::PERLBIND module, which implements the connection and caching mechanisms required to communicate with a Caché server.
This module requires the following environment:
UNIX® Installation
Windows Installation
Caché Server Configuration
Very little configuration is required to use a Perl client with a Caché server. The Perl sample programs provided with Caché should work with no change following a default Caché installation. This section describes the server settings that are relevant to Perl and how to change them.
Every Perl client that wishes to connect to a Caché server needs the following information:
By default, the Perl sample programs use the following connection information:
Check the following points if you have any problems:
Sample Programs
Caché comes with a set of sample programs that demonstrate the use of the Caché Perl binding. These samples are located in the <cachesys>/dev/perl/samples/ subdirectory of the Caché installation. (For the location of <cachesys> on your system, see Default Caché Installation Directory in the Caché Installation Guide). They are named, numbered, and implemented to correspond to the Java binding samples.
The sample programs include:
All of these applications use classes from the Sample package in the SAMPLES namespace (accessible in Atelier). If you have not used the Sample package before, you should open it in Atelier and make sure it is properly compiled.
The sample programs are controlled by various switches that can be entered as arguments to the program on the command line. The sample program supplies a default value if you do not enter an argument.
For example, accepts the following optional arguments:
A -user argument would be specified as follows:
   perl -user _MYUSERNAME
The sample accepts a -query argument that is passed to an SQL query:
   perl -query A
This query will list all Sample.Person records containing names that start with the letter A.

Send us comments on this page
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA