In both Python and Java we have import
to eliminate the repetition of fully-qualified package/module names throughout code. Is there any equivalent in Perl/Moose? I think it would really make Moose nicer to use if we didn't have to repeat MyApp::Model::Item
. Instead, I'd like to [somehow declare] MyApp::Model::Item;
and later on, simply refer to Item
. I can think of all of these use-cases where class names are used...
extends 'Item';
with 'ItemRole';
Item->new(name => 'thing');
method foo(Item $xyz) { ... }
, withMooseX::Method::Signatures
$var->isa('Item');
try { ... } catch (DatabaseError $e) { ... }
, withTryCatch
$Item::SOME_PACKAGE_GLOBAL_VARIABLE
If there is no such thing yet, any idea on how I might start to cleanly implement this? I can see that it would be tricky to deal with cases where the classname is used as a string.