in reply to Package shortener and loader

Actually there is a much simpler and non-magickal way to handle my requirements since I'm already using Moose. I will just create a Role method that takes a shortened package name and does the loading of it:
my $instance = $self->gnew(LastPartOfLongPackageName, @args_to_constructor);
And the code is non-magickal:
package XML::Quickbooks::Util; # ABSTRACT: various utility functions use Moose::Role; sub gnew { my($self, $pkgtail, @constructor_args)=@_; use Class::MOP; my $class = "XML::Quickbooks::Generator::$pkgtail"; Class::MOP::load_class($class); $class->new(@constructor_args); }




The mantra of every experienced web application developer is the same: thou shalt separate business logic from display. Ironically, almost all template engines allow violation of this separation principle, which is the very impetus for HTML template engine development.

-- Terence Parr, "Enforcing Strict Model View Separation in Template Engines"