92
|
42 |
0 |
{'_method', sub {
($name, $code) = splice(@args, 0, 2);
push @acc, "__$name", sub {
$code;
}
if defined $code;
push @acc, "_$name", '$';
push @methods, $name, $code;
}
, '_index', sub {
($name, $type) = splice(@args, 0, 2);
push @acc, $name, $type;
}
, '_lvalue', sub {
($name, $type) = splice(@args, 0, 2);
push @acc, "_$name", $type;
push @lvalue, $name;
}
, '_rw', sub {
($name, $type) = splice(@args, 0, 2);
push @acc, "_$name", $type;
if (defined $args[0] and lc $args[0] eq 'abstract') {
shift @args;
}
else {
$type = &_type_of($type) if ref $type eq 'CODE';
my $coderef = $HO::accessor::rw_accessor{$type};
Carp::croak("Unknown property type '${type}', in setup for class $class.") unless defined $coderef;
push @r_, $name, [$coderef, $name, $class];
};
}
, '_ro', sub {
($name, $type) = splice(@args, 0, 2);
push @acc, "_$name", $type;
if (defined $args[0] and lc $args[0] eq 'abstract') {
shift @args;
}
else {
$type = &_type_of($type) if ref $type eq 'CODE';
my $coderef = $HO::accessor::ro_accessor{$type};
Carp::croak("Unknown property type '${type}', in setup for class $class.") unless defined $coderef;
push @r_, $name, [$coderef, $name, $class];
};
}
, 'init', sub {
$makeinit = shift @args;
}
, 'noconstructor', sub {
$makeconstr = 0;
}
, 'alias', sub {
push @alias, splice(@args, 0, 2);
}
}->{$action} || sub {
die "Unknown action '${action}' for $package.";
}
|