annotate lib/IMPL/Test/Result.pm @ 413:af8d359ee4cc ref20150831

working on di container
author cin
date Thu, 24 Sep 2015 12:19:30 +0300
parents 9335cf010b23
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
1 package IMPL::Test::Result;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
2 use strict;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
3 use warnings;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
4
410
9335cf010b23 refactoring
cin
parents: 407
diff changeset
5 use IMPL::Const qw(:prop);
9335cf010b23 refactoring
cin
parents: 407
diff changeset
6 use IMPL::declare {
9335cf010b23 refactoring
cin
parents: 407
diff changeset
7 base => [
9335cf010b23 refactoring
cin
parents: 407
diff changeset
8 'IMPL::Object' => undef,
9335cf010b23 refactoring
cin
parents: 407
diff changeset
9 'IMPL::Object::Serializable' => '@_'
9335cf010b23 refactoring
cin
parents: 407
diff changeset
10 ],
9335cf010b23 refactoring
cin
parents: 407
diff changeset
11 props => [
9335cf010b23 refactoring
cin
parents: 407
diff changeset
12 name => PROP_RW,
9335cf010b23 refactoring
cin
parents: 407
diff changeset
13 state => PROP_RW,
9335cf010b23 refactoring
cin
parents: 407
diff changeset
14 exception => PROP_RW,
9335cf010b23 refactoring
cin
parents: 407
diff changeset
15 timeExclusive => PROP_RW,
9335cf010b23 refactoring
cin
parents: 407
diff changeset
16 timeInclusive => PROP_RW
9335cf010b23 refactoring
cin
parents: 407
diff changeset
17 ]
9335cf010b23 refactoring
cin
parents: 407
diff changeset
18 };
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
19
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
20 __PACKAGE__->PassThroughArgs;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
21
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
22 use constant {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
23 SUCCESS => 0,
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
24 FAIL => 1,
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
25 ERROR => 2
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
26 };
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
27
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
28 sub CTOR {
410
9335cf010b23 refactoring
cin
parents: 407
diff changeset
29 my $this = shift;
9335cf010b23 refactoring
cin
parents: 407
diff changeset
30
9335cf010b23 refactoring
cin
parents: 407
diff changeset
31 my $fields = @_ == 1 ? $_[0] : {@_};
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
32
410
9335cf010b23 refactoring
cin
parents: 407
diff changeset
33 $fields->{timeExclusive} ||= 0;
9335cf010b23 refactoring
cin
parents: 407
diff changeset
34 $fields->{timeInclusive} ||= 0;
9335cf010b23 refactoring
cin
parents: 407
diff changeset
35
9335cf010b23 refactoring
cin
parents: 407
diff changeset
36 while (my ($k,$v) = each %$fields) {
9335cf010b23 refactoring
cin
parents: 407
diff changeset
37 $this->$k($v);
9335cf010b23 refactoring
cin
parents: 407
diff changeset
38 }
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
39 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
40
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
41
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
42 1;