diff lib/IMPL/Test/Result.pm @ 410:9335cf010b23 ref20150831

refactoring
author cin
date Mon, 14 Sep 2015 01:11:53 +0300
parents c6e90e02dd17
children
line wrap: on
line diff
--- a/lib/IMPL/Test/Result.pm	Sun Sep 13 19:30:49 2015 +0300
+++ b/lib/IMPL/Test/Result.pm	Mon Sep 14 01:11:53 2015 +0300
@@ -2,8 +2,20 @@
 use strict;
 use warnings;
 
-use parent qw(IMPL::Object IMPL::Object::Autofill IMPL::Object::Serializable);
-use IMPL::Class::Property;
+use IMPL::Const qw(:prop);
+use IMPL::declare {
+	base => [
+		'IMPL::Object' => undef,
+		'IMPL::Object::Serializable' => '@_'
+	],
+	props => [
+		name => PROP_RW,
+		state => PROP_RW,
+		exception => PROP_RW,
+		timeExclusive => PROP_RW,
+		timeInclusive => PROP_RW
+	]
+};
 
 __PACKAGE__->PassThroughArgs;
 
@@ -13,19 +25,17 @@
     ERROR => 2
 };
 
-BEGIN {
-    public property Name => prop_all;
-    public property State => prop_all;
-    public property Exception => prop_all;
-    public property TimeExclusive => prop_all;
-    public property TimeInclusive => prop_all;
-}
-
 sub CTOR {
-    my ($this) = @_;
+    my $this = shift;
+    
+    my $fields = @_ == 1 ? $_[0] : {@_};
     
-    $this->TimeInclusive(0) unless defined $this->TimeInclusive;
-    $this->TimeExclusive(0) unless defined $this->TimeExclusive;
+    $fields->{timeExclusive} ||= 0;
+    $fields->{timeInclusive} ||= 0;
+    
+    while (my ($k,$v) = each %$fields) {
+    	$this->$k($v);
+    }
 }