9 package MooseX::SomeAwesomeDBFields;
13 sub inline_create_instance {
14 my ($self, $classvar) = @_;
16 "bless SomeAwesomeDB::new_row(), $classvar";
19 sub inline_get_slot_value {
20 my ($self, $invar, $slot) = @_;
22 "SomeAwesomeDB::read($invar, \"$slot\")";
25 sub inline_set_slot_value {
26 my ($self, $invar, $slot, $valexp) = @_;
28 "SomeAwesomeDB::write($invar, \"$slot\", $valexp)";
31 sub inline_is_slot_initialized {
32 my ($self, $invar, $slot) = @_;
37 sub inline_initialize_slot {
38 my ($self, $invar, $slot) = @_;
43 sub inline_slot_access {
44 die "inline_slot_access should not have been used";
47 # implementation of methods not called in the example deliberately
53 use Moose::Util::MetaRole;
55 use Test::More tests => 3;
58 Moose::Util::MetaRole::apply_metaclass_roles
59 (for_class => __PACKAGE__,
60 instance_metaclass_roles => [ 'MooseX::SomeAwesomeDBFields' ]);
69 } "Adding lazy accessor does not use inline_slot_access";
75 } "Adding read-write accessor does not use inline_slot_access";
77 lives_ok { __PACKAGE__->meta->make_immutable; }
78 "Inling constructor does not use inline_slot_access";