Tie::RemoteVar - Share variables everywhere


  use Tie::RemoteVar;

  # server side
  my $vs = Tie::RemoteVar->new(allow => '');

  # client side
  tie(%HASH, 'Tie::RemoteVar', id => 'meatball');
  untie %HASH;


Users can treat inter-process or even inter-host variables almost as normal ones using Tie::RemoteVar instead of stereotypical tedious coding.

To use this facility, users need to setup a server first. It is simple. The only requirements are allowed hosts' addresses and server's port.

Localhost access is not presumed valid before users make an explicit statement.

  my $vs = Tie::RemoteVar->new(
                               port => 1234    # default is 1234
                               allow => [ 

then start it


After setup is completed, users are empowered to access variables across processes or hosts. Likewise, default port is 1234 and default host is Additionally, users need to specify the variable's identifier on server, which is similar to the key used in shmget. It is required in order to locate variable after program's termination.

  [$x =] tie(%HASH, 'Tie::RemoteVar', id => 'meatball');

  [$x =] tie(@ARRAY, 'Tie::RemoteVar',
             addr => '', port => 1234, id => 'spaghetti');

  [$x =] tie($SCALAR, 'Tie::RemoteVar',
             port => 1234, id => 'YangZhou ChaoFan');

  untie $SCALAR;
  untie @ARRAY;
  untie %HASH;

Since variables must be preserved after termination of scripts, users cannot use untie or undef to destroy variables. Instead, Tie::RemoteVar provides erase to perform this task.


It will erase the variable stored on the server.


  • Tie-filehandle is not supported.

  • Cannot handle variables of complex structure.


Recursive copy of Perl datatypes.


xern <>

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