use warnings;
sub generate_constructor_method_inline {
- my ($class, $meta) = @_;
- my $code = $class->_generate_constructor_method_inline($meta);
- warn $code if $ENV{DEBUG};
-
- local $@;
- my $res = eval $code;
- die $@ if $@;
- $res;
-}
-
-sub _generate_constructor_method_inline {
my ($class, $meta) = @_;
+
my $buildall = $class->_generate_BUILDALL($meta);
my $buildargs = $class->_generate_BUILDARGS();
- my $classname = $meta->name;
my $processattrs = $class->_generate_processattrs($meta);
- return <<"...";
+ my $code = <<"...";
sub {
my \$class = shift;
my \$args = $buildargs;
- my \$instance = bless {}, '$classname';
- my \$meta = \$instance->meta;
+ my \$instance = bless {}, \$class;
$processattrs;
$buildall;
return \$instance;
}
...
+
+ warn $code if $ENV{DEBUG};
+
+ local $@;
+ my $res = eval $code;
+ die $@ if $@;
+ $res;
}
sub _generate_processattrs {