all tests run at trace log level with a null log output; new tests for watchdog,...
[scpubgit/Object-Remote.git] / t / lib / ORTestTiedRemote.pm
diff --git a/t/lib/ORTestTiedRemote.pm b/t/lib/ORTestTiedRemote.pm
new file mode 100644 (file)
index 0000000..e859b06
--- /dev/null
@@ -0,0 +1,46 @@
+package ORTestTiedRemote;
+
+use Moo; 
+
+use Tie::Array;
+use Tie::Hash; 
+
+has hash => ( is => 'ro',  builder => 1 );
+has array => ( is => 'ro', builder => 1 );
+
+sub _build_hash {
+    tie(my %hash, 'Tie::StdHash');
+    %hash = ( akey => 'a value');
+    return \%hash;
+} 
+
+sub _build_array {
+    tie(my @array, 'Tie::StdArray');
+    @array = ('another value');
+    return \@array;
+}
+
+sub sum_array {
+    my ($self) = @_;
+    my $sum = 0;
+    
+    foreach(@{$self->array}) {
+        $sum += $_;
+    }  
+    
+    return $sum; 
+}
+
+sub sum_hash {
+    my ($self) = @_; 
+    my $sum = 0;
+    
+    foreach(values(%{$self->hash})) {
+        $sum += $_;
+    }
+    
+    return $sum; 
+}
+
+1;
+