Make the generated action method fit better into what the StompTestApp::Controller...
[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 DemoTypeLibrary qw/MessageDocument/;
11 use MooseX::Lexical::Types qw/MessageDocument/;
12 use namespace::autoclean;
13
14 # Note trivial calling convention.
15 # Apply MX::Method::Signatures and MX::Types::Structured to be less lame.
16
17 # Introspection should only reflect methods which satisfy the calling convention
18 # This is left as an exercise to the reader. :)
19
20 # Note command syntax not actually needed, this could be a normal sub,
21 # but doing so makes the eventual merge harder..
22
23 command say_hello => sub {
24     my ($self, $document) = @_;
25
26     my $name = $document->{name};
27     return({ type => 'say_hello_response',
28
29             body => "Hello $name" });
30 };
31
32 with 'SomeModelClassInterface';
33
34 before 'say_hello' => sub {
35     my $self = shift;
36     my MessageDocument $message = shift;
37 };
38
39 __PACKAGE__->meta->make_immutable;
40