Make the generated action method fit better into what the StompTestApp::Controller...
[catagits/CatalystX-DynamicComponent.git] / t / lib / SomeModelClass.pm
CommitLineData
61ef2dee 1package SomeModelClassInterface;
2use Moose::Role;
3use namespace::autoclean;
4
5requires 'say_hello';
6
7d26c84b 7package SomeModelClass;
8use Moose;
8c228ad4 9use CatalystX::ControllerGeneratingModel;
d7bd7765 10use DemoTypeLibrary qw/MessageDocument/;
11use MooseX::Lexical::Types qw/MessageDocument/;
046d763d 12use namespace::autoclean;
7d26c84b 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
d7bd7765 20# Note command syntax not actually needed, this could be a normal sub,
21# but doing so makes the eventual merge harder..
22
8c228ad4 23command say_hello => sub {
d7bd7765 24 my ($self, $document) = @_;
25
26 my $name = $document->{name};
27 return({ type => 'say_hello_response',
28
29 body => "Hello $name" });
8c228ad4 30};
7d26c84b 31
61ef2dee 32with 'SomeModelClassInterface';
33
d7bd7765 34before 'say_hello' => sub {
35 my $self = shift;
36 my MessageDocument $message = shift;
37};
38
7d26c84b 39__PACKAGE__->meta->make_immutable;
40