NAME

Win32::InstallShield - InstallShield data file interface

SYNOPSIS

use InstallShield;

# Constructors
$is = Win32::InstallShield->new();
$is = Win32::InstallShield->new( $ism_file );

ABSTRACT

An OO interface for manipulating InstallShield XML .ism files

DESCRIPTION

This module provides an interface to add, remove and modifify rows in an InstallShield .ism file. It only supports versions of InstallShield that save their data as XML.

EXAMPLES

This example updates the product version.

use Win32::InstallShield;

$is = Win32::InstallShield->new( $ism_file );
$is->UpdateProperty(
    { 
        Property => 'ProductVersion',
        Value    => '1.2.3.4',
    }
);

$is->save_file( $ism_file );

METHODS

new
$is = Win32::InstallShield->new();
$is = Win32::InstallShield->new( $installshield_filename );
$is = Win32::InstallShield->new( $io_file_handle );

The constructor. Can optionally be called with the same arguments as loadfile.

loadfile
$is->loadfile( $filename );
$is->loadfile( $io_file_handle );

Loads an InstallShield ism file. Can be called with either a filename or an IO::File object that is opened in read ("r") mode. Returns 1 on success, 0 on failure.

load
$is->load( $ism_text );

Loads the supplied text of an InstallShield ism file. Returns 1 on success, 0 on failure.

savefile
$is->savefile( $filename );
$is->savefile( $io_file_handle );

Stores the ism data in a file. Can be called with either a filename or an IO::File object that is opened in write ("w") mode. Returns 1 on success, 0 on failure.

save
$is->save();

Returns the ism data as a string.

column_is_key
my $is_key = $is->column_is_key( $table, $column_name );

Returns true if the column is a key column, false other wise. Returns undef if the column doesn't exist.

column_width
my $width = $is->column_width( $table, $column_name );

Returns the width of the named column. Returns undef if the column doesn't exist.

column_type
my $type = $is->column_type( $table, $column_name );

Returns the type of the named column. Returns undef if the column doesn't exist.

columns
my $columns = $is->columns( $table );

Returns an array ref containing the names of the columns in the given table.

key_columns
my $key_columns = $is->key_columns( $table );

Returns an array ref containing the names of the key columns in the given table.

ROW MANIPULATION METHODS

Row manipulation methods can be called in different ways. First, they are all case insensitve, and the '_' is optional, so for the 'Property' table, these are equivilent:

$is->add_row( 'Property', $rowdata );
$is->AddRow( 'Property', $rowdata );

Also, you can call each method using the table name in place of the word 'row', so these are equivilent to the two above:

$is->add_property( $rowdata );
$is->AddProperty( $rowdata );

All row manipulation methods are called with a set of data describing a row. In the methods below, it is represented by the variable $rowdata. It can be passed to the function in one of three formats: a list, an array ref or a hash ref.

List

You can simply put the columns in an array in the correct order (which you can get by looking at the ism or calling the columns method), and pass it to the method.

my @rowdata = ( 'Column_1_Value', 'Column_2_value' );
$success = update_row( $table, @rowdata );

Array ref

You can do the same as above, but pass it as a single array reference.

$success = update_row( $table, \@rowdata );

Hash ref

You can also pass a hash ref, using column names as keys.

my %rowdata = (
    Property   => 'ProductVersion',
    Value      => '1.2.3.4',
    ISComments => '',
);
$success = update_row( $table, \%rowdata );
gethash_row
my $row = gethash_row( $table, $rowdata );

Returns a hash ref containing the data that matches the keys supplied in $rowdata. Returns undef if the row is not found.

getarray_row
my $row = getarray_row( $table, $rowdata );

Returns an array ref containing the data that matches the keys supplied in $rowdata. Returns undef if the row is not found.

update_row
my $success = update_row( $table, $rowdata );

Updates the row that matches the keys supplied in $rowdata. Any columns for which an undef is supplied will remain unchanged. An empty string will force the column to be empty. Returns 1 on success, 0 on failure.

add_row
my $success = add_row( $table, $rowdata );

Adds a row containing the data in $rowdata. Returns 1 on success, 0 on failure.

del_row
my $success = del_row( $table, $rowdata );

Deletes the row that matches the keys supplied in $rowdata. Returns 1 on success, 0 on failure.

AUTHOR

Kirk Baucom, <kbaucom@schizoid.com>