# from Sébastien Aperghis-Tramoni
# on Tuesday 09 October 2007 00:07:
>> This changes the require() on Foo::Report and Foo::Customer to run-
>> time though, right?
>
>Right, but I'd say that for writing object-oriented code, there isn't
> such a need to do things at compile time, is it?
Probably not, but they're still different, and thus could lead to
head-scratching.
If the shorthand feature just installed a subroutine (what aliased
does), there would be no difference.
use relative 'Foo';
Foo->new;
is:
BEGIN {
require relative;
relative->import('Foo');
}
Foo->new;
Where the scalar usage is like:
BEGIN {
require relative;
}
my $Foo = relative->import('Foo');
$Foo->new;
You can use scalars in this way (via $_[2] = 'Bar::Foo'), but they have
to be declared before the use line.
my $Foo;
use relative Foo => $Foo;
$Foo->new;
So, I'm inclined to think that the sub is the way to go, though it would
be nice if they went away at runtime (in order to not be accidental
methods.) 5.10 and $^H anyone?
--Eric
--
"Time flies like an arrow, but fruit flies like a banana."
--Groucho Marx
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------