PURPOSE
A simple example of a class using the construct_instance method.
Two roles hook onto it. One of them auto-loads classes at run time:
before construct_instance => sub {
my ($self, $class) = @_;
Module::Runtime::use_package_optimistically($class);
};
The other uses an around modifier to tweak the constructed instance:
around construct_instance => sub {
my $orig = shift;
my $self = shift;
my $inst = $self->$orig(@_);
...;
return $inst;
};
AUTHOR
Toby Inkster <tobyink@cpan.org>.
COPYRIGHT AND LICENCE
This software is copyright (c) 2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.