NAME
    Lexical::Alias - makes a lexical an alias for another variable

SYNOPSIS
      require 5.008;
      use Lexical::Alias;

      my ($src, $dst);
      alias $src, $dst;

      my (@src, @dst);
      alias @src, @dst;

      my (%src, %dst);
      alias %src, %dst;

      # modifying $src/@src/%src
      # modifies $dst/@dst/%dst,
      # and vice-versa

      # or, if supporting Perls prior to v5.8:

      use Lexical::Alias qw( alias_r alias_s alias_a alias_h );

      my ($src, $dst);
      alias_s $src, $dst;

      my (@src, @dst);
      alias_a @src, @dst;

      my (%src, %dst);
      alias_h %src, %dst;

      alias_r \$src, \$dst;
      alias_r \@src, \@dst;
      alias_r \%src, \%dst;

DESCRIPTION
    This module allows you to alias a lexical (declared with "my") variable
    to another variable (package or lexical). You will receive a fatal error
    if you try aliasing a scalar to something that is not a scalar (etc.).

  Exported Functions
    * "alias(src, dst)"
        Makes *dst* (which must be lexical) an alias to *src* (which can be
        either lexical or a package variable). *src* and *dst* must be the
        same data type (scalar and scalar, array and array, hash and hash).

        This is only available in Perl v5.8 and later, where it is exported
        automatically.

    * "alias_s($src, $dst)"
        Makes *dst* (which must be lexical) an alias to *src* (which can be
        either lexical or a package variable). This is not exported by
        default.

    * "alias_a(@src, @dst)"
        Makes *dst* (which must be lexical) an alias to *src* (which can be
        either lexical or a package variable). This is not exported by
        default.

    * "alias_h(%src, %dst)"
        Makes *dst* (which must be lexical) an alias to *src* (which can be
        either lexical or a package variable). This is not exported by
        default.

    * "alias_r(\src, \dst)"
        Makes *dst* (which must be lexical) an alias to *src* (which can be
        either lexical or a package variable). *src* and *dst* must be the
        same data type (scalar and scalar, array and array, hash and hash).
        This is not exported by default.

  Caveats
    Because one variable is an alias for the other, making either one an
    alias for *another* variable makes them *both* aliases for it:

      use Lexical::Alias;

      my ($x, $y, $z);
      alias $x => $y;  # $y is an alias for $x
      alias $z => $y;  # $y (and thus $x) is an alias for $z
      $z = 10;
      print $x;        # 10

    This is not a bug.

AUTHOR
    Jeff "japhy" Pinyan, japhy@pobox.com

    Thanks to Tye McQueen for a bug fix -- this module should work from
    5.005 on.

    http://www.pobox.com/~japhy/

SEE ALSO
    Devel::LexAlias, by Richard Clamp, from which I got (and modified) the
    code necessary for this module. I've wanted this feature for some time,
    and Richard opened the door with this module.

