in reply to perl equivalent to ruby's alias

Since nobody mentioned it so far: take a look at Data::Alias.

Replies are listed 'Best First'.
Re^2: perl equivalent to ruby's alias
by dragonchild (Archbishop) on Sep 26, 2008 at 03:22 UTC
    I think Attribute::Alias might work better.
    sub foo :Alias(bar) { ... } # These both do the same thing. foo(); bar();

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Re^2: perl equivalent to ruby's alias
by JadeNB (Chaplain) on Sep 28, 2008 at 18:59 UTC
    Does this really do what the poster wants? My impression was that Data::Alias is designed more to handle magic aliasing of scalars (possibly references), such as occurs in fors and subroutines, than to handle non-scalars such as subroutines. Of course, you can use
    alias *old_func = \&new_func,
    but I don't see what that gains over just
    *old_func = \&new_func.
    I searched the Data::Alias documentation for 'code' and 'function', but couldn't find anything indicating what I might be missing.