|
Revision 19289, 0.7 kB
(checked in by daisuke, 5 years ago)
|
|
暇だったのでとりあえず作ったが、中途半端すぎて泣ける。
|
-
Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 | # $Id$ |
|---|
| 2 | |
|---|
| 3 | package Morris::Message; |
|---|
| 4 | use Moose; |
|---|
| 5 | use Moose::Util::TypeConstraints; |
|---|
| 6 | use Morris::Client::Address; |
|---|
| 7 | |
|---|
| 8 | class_type 'Morris::Client::Address'; |
|---|
| 9 | |
|---|
| 10 | coerce 'Morris::Client::Address' |
|---|
| 11 | => from 'Str' |
|---|
| 12 | => via { Morris::Client::Address->new($_) } |
|---|
| 13 | ; |
|---|
| 14 | |
|---|
| 15 | no Moose::Util::TypeConstraints; # hide 'from' |
|---|
| 16 | |
|---|
| 17 | has 'from' => ( |
|---|
| 18 | is => 'rw', |
|---|
| 19 | isa => 'Morris::Client::Address', |
|---|
| 20 | coerce => 1, |
|---|
| 21 | required => 1, |
|---|
| 22 | handles => [ qw(modifier nickname username hostname) ] |
|---|
| 23 | ); |
|---|
| 24 | |
|---|
| 25 | has 'channel' => ( |
|---|
| 26 | is => 'rw', |
|---|
| 27 | isa => 'Str', |
|---|
| 28 | ); |
|---|
| 29 | |
|---|
| 30 | has 'message' => ( |
|---|
| 31 | is => 'rw', |
|---|
| 32 | isa => 'Str', |
|---|
| 33 | ); |
|---|
| 34 | |
|---|
| 35 | has 'timestamp' => ( |
|---|
| 36 | is => 'ro', |
|---|
| 37 | isa => 'Int', |
|---|
| 38 | default => sub { time() } |
|---|
| 39 | ); |
|---|
| 40 | |
|---|
| 41 | __PACKAGE__->meta->make_immutable; |
|---|
| 42 | |
|---|
| 43 | no Moose; |
|---|
| 44 | |
|---|
| 45 | 1; |
|---|