Metamerge logo
Search

Advanced Search
*
*
*
* HOME DOCUMENTS & RESOURCES DOWNLOADS EARLY TECH ACCESS SUPPORT FAQ KNOWN ISSUES OLD VERSIONS
*

 

Perl

Special considerations:

First of all, in order to get a Perl Parser to work, you need a Perl that supports Windows Scripting Host (WSH) engines.   Only ActivePerl (that you can get for free from http://www.activestate.com/) has been verified.  Also note that WSH only works on NT/Windows 2000 platforms, so currently you cannot run a Perl Parser from a Unix server.  

Description:

You have access to the standard Java objects from Perl, so the good news are that the general documentation can be used: The Java object JavaObject  is in Perl accessed as $JavaObject, and JavaObject.Method() through $JavaObject->Method()

 

For example, input in an iterator Connector is done though the inp object, so 

    $_ = $inp->readLine();

will assign next line on the input stream to $_

Connector attributes are set/read by the entry attribute:

     $entry->setAttribute("Number", $number); 

will set the (self chosen) Connector attribute Number to the internal Perl scalar $number.

When writing a Parser, you typically must write the subroutines readEntry and writeEntry :  Those are the ones that will be called for input/output.  A minimal but useless script is included here.  A complete assemblyline example using a Perl-Parser that reads and write is included here.

Example:

Here is how to create multiple values ("foo" and "bar") in attributes ("Multi1" and "Multi2"): 

# Create an attribute called Multi1(see the entry object)

$entry->setAttribute("Multi1", "foo");

# Add an other value to it (see the attribute object)

$attr = $entry->getAttribute("Multi1");
$attr ->addValue("bar");

But there's more than one way:

# Create an attribute called Multi2 (assuming it does not exist)

$entry->addAttributeValue("Multi2", "foo");

# Add an other value to it

$entry->addAttributeValue("Multi2", "bar");

 

 

 

*
  Metamerge Integrator version 4.6 ©Copyright Metamerge AS 2000-2002 Last edited 2002-06-10 contact us