83f7271302f40af6f79ae23164bdfaa903df8475
[catagits/CatalystX-DynamicComponent.git] / t / lib / SomeModelClass.pm
1 package SomeModelClassInterface;
2 use Moose::Role;
3 use namespace::autoclean;
4
5 requires 'say_hello';
6
7 package SomeModelClass;
8 use Moose;
9 use CatalystX::ControllerGeneratingModel;
10 use namespace::autoclean;
11
12 # Note trivial calling convention.
13 # Apply MX::Method::Signatures and MX::Types::Structured to be less lame.
14
15 # Introspection should only reflect methods which satisfy the calling convention
16 # This is left as an exercise to the reader. :)
17
18 # Note command syntax not actually needed, this could be a normal sub,
19 # but doing so makes the eventual merge harder..
20
21 command say_hello => sub {
22     my ($self, $document) = @_;
23
24     my $name = $document->{name};
25     return({ type => 'say_hello_response',
26
27             body => "Hello $name" });
28 };
29
30 with 'SomeModelClassInterface';
31
32 __PACKAGE__->meta->make_immutable;
33