Hi monks,
I thought about writing a module, which allows an easy way to alias perl built-in functions.
For example the bless function an evil monk would not want to use all day, but he might be happy to curse or damn the references.
use Acme::Alias bless => [qw(curse damn)]; my $string = "foo"; my $obj = curse \$string, 'CursedString'; my $obj2 = damn \$string, 'DamnedString';
My feeling is that that somewhere on CPAN a module with this functionality should exist. However I did not find it. Do you happen to know such a module?
Alternatively one could upload:
package Acme::Alias; use Filter::Simple; use strict; use warnings; our $VERSION = '0.01'; our %Symbols = (); sub import() { shift; my %all = @_; for (keys %all){ if ( ref($all{$_}) eq 'ARRAY'){ $Symbols{$_} = join q(|), @{$all{$_}}; } else { $Symbols{$_} = $all{$_} } } } FILTER_ONLY code => sub { while (my ($key,$val) = each %Symbols){ s/$val/$key/gs; } }; 1;
In reply to Aliasing built-in Functions by codeacrobat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |