Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
aliased is now on the CPAN. The syntax is cleaned up from what I originally had.
# implicit alias:
use aliased 'Some::Long::Module::Name';
# explicit alias:
use aliased 'Some::Long::Module::Name' => 'Name';
# import lists require using explicit aliasing:
use aliased 'Some::Long::Module::Name'=> 'Name, qw/foo bar baz/;
# and all of the above allow you to call class methods
# on the alias:
my $new_name = Name->new;
my $old_name = Name->search($id); # etc.
Why not use namespace? (Score:2)
-sam
Re:Why not use namespace? (Score:2)
First, if you just want the last part of the class name, aliased has the simpler syntax:
Second, compare the implementations. I am just exporting a single subroutine. namespace jumps through a lot of weird hoops, diddles the aliased @ISA array, and has rather coplicated code. Further, it will die if the target n
Re:Why not use namespace? (Score:2)
-sam
Re:Why not use namespace? (Score:2)
I was mistaken. namespace also does not allow function calls. In trying this with my test suite, I have this:
It says that This::Name::new is an undefined subroutine. But, it turns out the problem is worse than that!