The Perl Advent Calendar needs more articles for 2022. Submit your idea today!


IPC::Door - Interface to Solaris (>= 2.6) Door library


The server script:

    use IPC::Door::Server;
    use Fcntl;
    my  $door = "/path/to/door";
    my  $dserver = new IPC::Door::Server($door, &mysub);
    while (1) {
        die "$door disappeared: $!\n" unless IPC::Door::is_door($door);
        sysopen( DOOR, $door, O_WRONLY ) || die "Can't write to $door: $!\n";
        close DOOR;
        select undef, undef, undef, 0.2;

    sub mysub {
        my $arg = shift;
        # do something
        my $ans;
        return $ans;

The client script:

    use IPC::Door::Client;
    use Fcntl;
    my  $door = "/path/to/door";
    my  $dclient = new IPC::Door::Client($door);
    my  $data;
    my  $answer = $client->call($data, O_RDWR);


IPC::Door is a Perl extension to the door library present in Solaris 2.6 and later.



The method new initializes the object, taking a mandatory argument $path. Each IPC::Door::* object is thus associated with a door through which it communicates with a server (if the object is a ::Client) or a client (if the object is a ::Server).

In addition, the IPC::Door::Server object requires a reference to a code block &mysub, which will be a part of the server process upon compilation. See IPC::Door::Server.




Subroutine is_door can be called either as an object method or as a subroutine.

If the former, it determines if the path name assoicated with the object is a door. In the latter case, it determines if the path name passed to it is a door.


    my ($target, $attr, $uniq) = IPC::Door::info($door);

Subroutine info takes the path to a door and return array ($target, $attributes, $uniquifer). $target is the server process id that is listening through the door. $attributes is the integer that represents the attributes of the door (see "Door attributes"), and $uniquifer is the system-wide unique number associated with the door.

Door attributes

When testing for a door's attributes, it is convenient to import some symbols:

use IPC::Door qw( :attr );


Note that not all symbols are available in all versions of Solaris.


1. Incomaptible with threaded perl

I know this module does not work nicely if perl was configured with -Dusethreads option. I know that the precompiled package from has this option set. I am not sure about the one from

2. Compatibility with other door clients and servers

The doors created by IPC::Door::Server evaluates the passed data in the scalar context before passing it to the door server. If you want to pass complex data structures, use the Storable module, which is standard as of Perl 5.8.0.

Data an IPC::Door::Server object returns are probably incomprehensible and useless for non-IPC::Door::Client processes. You can read the source to find out exactly what are passed around, but it might not be worth your while to do that, when you can simply use IPC::Door::Client. (And of course, I might change the internal data structure in the future.)

Conversely, IPC::Door::Client can read data from doors created by non-IPC::Door::Server processes, but it is entirely up to the IPC::Door::Client process to make sense of what's read.

3. Some door_* routines not implemented

Some door library routines door_bind, door_revoke, door_server_create, and door_unbind still need to be implemented. These routines contribute to custom door server creation, which may be too complicated and unnecessary for this module's needs; if such a fine control over the server creation process is required, perhaps you should be writing your utility in C! If you are really interested in this sort of thing, contact the author.

door_info is only partially implemented.

4. Incomplete error checking

There should be more robust error checking and more friendly error messages throughout.

5. Limited testing

IPC::Door has been tested on Solaris 8 (with Sun Workshop compiler), 9 (with gcc 3.3), and 10 (with gcc 4.0.0) (all on SPARC).

I need more testing on following configurations (both SPARC and x86 unless otherwisse noted):

  • Solaris 9 and 10 with Sun ONE Studio compiler (or whatever Sun calls its C compiler these days).

  • 64-bit perl executable.

  • Threaded perl. (See above.)

  • Solaris 10 on x86.

Please let me know if you can help me test the module on these configurations.

6. A little inconsistent XS code

I'm still a beginner at XS (some may argue also at Perl), so the code, especially the XS portion, can be improved. Any suggestions are welcome.

7. Unicode compatibility

In my limited testing, I found that this module has difficulty dealing with Unicode data.


IPC::Door::Client, IPC::Door::Server

door_bind(3DOOR) (,

door_call(3DOOR) (,

door_create(3DOOR) (,

door_cred(3DOOR) (,

door_info(3DOOR) (,

door_return(3DOOR) (,

door_revoke(3DOOR) (,

door_server_create(3DOOR) (,

door_ucred(3DOOR) (,

door_unbind(3DOOR) (,

UNIX Network Programming Volume 2: Interprocess Communications (

Solaris Internals: Core Kernel Architecture (


ASARI Hirotsugu <asarih at cpan dot org>



Copyright 2003-2005 by ASARI Hirotsugu

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