Skip to content

Commit

Permalink
allow ident to be a default fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed Oct 17, 2010
1 parent 638ac45 commit 50a46e0
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lib/Exception/Mine.pm
Expand Up @@ -20,18 +20,25 @@ has is_public => (
default => 0,
);

tc_subtype 'Exception::Mine::NonEmptyStr', tc_as 'Str', tc_where { length };
tc_subtype 'Exception::Mine::_NonEmptyStr',
tc_as 'Str',
tc_where { length };

tc_subtype 'Exception::Mine::_Ident',
tc_as 'Exception::Mine::_NonEmptyStr',
tc_where { ! /[%\v]/ };

has ident => (
is => 'ro',
isa => 'Exception::Mine::NonEmptyStr',
required => 1
isa => 'Exception::Mine::_Ident',
required => 1,
);

has message_fmt => (
is => 'ro',
isa => 'Str',
required => 1,
is => 'ro',
isa => 'Exception::Mine::_NonEmptyStr',
lazy => 1,
default => sub { $_[0]->ident },
init_arg => 'message',
);

Expand Down

0 comments on commit 50a46e0

Please sign in to comment.