Here's a different way, also using a 'as.pm', but no source
filters. Usage:
use as Name => "Very::Long::Class::Name", args ...;
And this is the code:
package as;
use strict;
use warnings;
sub import {
my $class = shift;
die "Usage: 'use as Name => Very::Long::Class::Name [args...]'"
unless @_ >= 2;
my $caller = caller ();
my ($short, $long) = splice @_ => 0, 2;
no strict 'refs';
@{"${short}::ISA"} = $long;
eval <<" --";
package $caller;
require $long;
$short -> import (\@_) if $short -> can ("import");
--
die $@ if $@;
}
1;
This follows a similar syntax as 'use if CONDITION, MODULE => ARGS'.
Abigail