The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Archive::Ipkg - Module for manipulation of iPKG archives


  use Archive::Ipkg;

  my $ipkg = Archive::Ipkg->new(
    name    => 'foo',
    version => '0.1');

  $ipkg->add_file($filename, $name_in_archive);
  $ipkg->add_file_by_data($filename, $data);

  $ipkg->description("Useless package of mine\nDon't use it!");

  my $data = $ipkg->data;


This module aids in the construction of iPKG packages (See links below for description of the implemented package format). The interface is somewhat similar to that of Archive::Tar, but with a couple differences. I consider the module to be in a beta stage.

The typical workflow is as follows: Create a new object, add files to it, set the properties of the iPKG package and write it to a file (or get the data as a scalar). There are a number of properties, and many of them are compulsory and need to be in a certain format. The module only generates the final package if the specs are meet. See below for a description of all properties and how to circumvent some of the checks.



$ipkg = Archive::Ipkg->new(...)

The new constructor creates a new object. You can pass any property to the constructor, if you want, or set the properties later.


The following functions add files to the internal data archive. All return undef on failure.


Is directly passed through to Archive::Tar to add several files.

$ipkg->add_file_by_data($filename, $data [, $properties_hash]);

Is directly passed through to Archive::Tar to add a file given its name, contents and optionally some properties. See Archive::Tar for a description of the properties available.

$ipkg-add_file($filename, $name_in_archive)>

A convenience function that lets you add a file with a new name. Reads the file's content and uses Archive::Tar's add_data to add the file.


$ctl = $ipkg->control()

Returns the text of the control file that will be written. You just need this if you want to check the file.

$errmsg = $ipkg->verify()

Verifies whether the archive can be written by checking whether at least the required properties are set (see below). Returns an error message if unsuccessful, else undef (!).


Writes the archive to disk, in the current directory. If no filename is given, it uses the internally generated default filename (see filename property). You can either set a filename of your own before writing or combine the default filename and a directory name to save the package in the directory of your choice. Returns undef on failure.


Returns the archive data as a scalar. Unlike Archive::Tar's data, this does not return the internal data structures, but rather the archive's contents as they would be written to disk. Returns undef on failure.


The following properties are obligatory: name, version, architecture, maintainer, section and description. Some of them have defaults set by the module, though, so you don't need to set all of them. If a property needs to be in a certain format, the accessor function will set the value to undef to make your write fail if you set an invalid value.

Except of sloppy_checks and strict_checks, all the following functions will return undef if a new value is set and the syntax check fails, else the properties (new) value.


Will switch of all syntax checks in accessor functions. verify will still check whether all required properties are set.


Re-enables syntax checks in accessor functions (this is the default).


The architecture the module is supposed to work on. Currently either arm or all

Default: arm


Marks a number of files (names contained in $array_ref) as configuration files, so ipkg will not automatically overwrite them. Note that you still need to add the files. Will not check whether the files are actually contained in the archive.

Default: No config files


The packages this package depends on, as a comma-separated list of package names (ie, matching /^[a-z0-9.+-]+(,[a-z0-9.+-]+)*$/ ).

Default: No depends

$ipkg->description("text, even on\nmultiple lines")

A short description of the module. Note that data and write will take appropriate care of newlines, so you don't have to do it yourself. Just write \n, as you normally would The description should be non-empty.

Default: No description, you need to set one.


The filename (including directory) of the module.

Default: $name_$version_$arch.ipkg

$ipkg->maintainer("Bozo the Clown,")

The maintainer's name and e-mail address (ie, matches /@/).


The package name. Matches /^[a-z0-9.+-]+$/.

Default: No name, you need to set one.


The package's priority. One of required, standard, important, optional, extra.

Default: optional


The package's section. Currently, the sections given in the Zaurus and in the Familiar documentation are allowed. These are the following:

Zaurus: Games Multimedia Communcations Settings Utilities Applications Console Misc

Familiar: admin base comm editors extras graphics libs misc net text web x11

Default: misc


The package's version, matching /^[a-zA-Z0-9.+]*$/ and having at least one digit.

Default: No version, you need to set one.


(Shell) script to be executed before installation.

Default: No script


(Shell) script to be executed after installation.

Default: No script


(Shell) script to be executed before removal.

Default: No script


(Shell) script to be executed after removal.

Default: No script


The following methods return the default values for the properties above.

my $val = $ipkg->default_architecture
my $val = $ipkg->default_priority
my $val = $ipkg->default_section
my $val = $ipkg->default_version


Can't read archives (yet).


Christian Renz <>


Copyright 2003 Christian Renz <>

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.