root/lang/perl/Morris/trunk/lib/Morris/Message.pm @ 26868

Revision 19289, 0.7 kB (checked in by daisuke, 5 years ago)

暇だったのでとりあえず作ったが、中途半端すぎて泣ける。

  • Property svn:keywords set to Id
Line 
1# $Id$
2
3package Morris::Message;
4use Moose;
5use Moose::Util::TypeConstraints;
6use Morris::Client::Address;
7
8class_type 'Morris::Client::Address';
9
10coerce 'Morris::Client::Address'
11    => from 'Str'
12        => via { Morris::Client::Address->new($_) }
13;
14
15no Moose::Util::TypeConstraints; # hide 'from'
16
17has 'from' => (
18    is => 'rw',
19    isa => 'Morris::Client::Address',
20    coerce => 1,
21    required => 1,
22    handles  => [ qw(modifier nickname username hostname) ]
23);
24
25has 'channel' => (
26    is => 'rw',
27    isa => 'Str',
28);
29
30has 'message' => (
31    is => 'rw',
32    isa => 'Str',
33);
34
35has 'timestamp' => (
36    is => 'ro',
37    isa => 'Int',
38    default => sub { time() }
39);
40
41__PACKAGE__->meta->make_immutable;
42
43no Moose;
44
451;
Note: See TracBrowser for help on using the browser.