Add a .shipit file
[gitmo/Moose.git] / t / 200_examples / 002_example_Moose_POOP.t
index 3a153c1..a7e0153 100644 (file)
@@ -6,28 +6,33 @@ use warnings;
 use Test::More;
 
 BEGIN {
-    eval "use DBM::Deep 0.983;";
-    plan skip_all => "DBM::Deep is required for this test" if $@;        
-    plan skip_all => "DBM::Deep (< 1.0) is required for this test" 
-        if DBM::Deep->VERSION >= 1.0;        
+    eval "use DBM::Deep 1.0003;";
+    plan skip_all => "DBM::Deep 1.0003 (or greater) is required for this test" if $@;              
     eval "use DateTime::Format::MySQL;";
     plan skip_all => "DateTime::Format::MySQL is required for this test" if $@;            
-    plan tests => 89;    
+    plan tests => 88;    
 }
 
 use Test::Exception;
 
 BEGIN {
-    use_ok('Moose');           
+    # in case there are leftovers
+    unlink('newswriter.db') if -e 'newswriter.db';
 }
 
+END {
+    unlink('newswriter.db') if -e 'newswriter.db';
+}
+
+
+
 =pod
 
 This example creates a very basic Object Database which 
 links in the instances created with a backend store 
 (a DBM::Deep hash). It is by no means to be taken seriously
-as a real-world ODB (see Presto for that), but is a proof 
-of concept of the flexibility of the ::Instance protocol. 
+as a real-world ODB, but is a proof of concept of the flexibility 
+of the ::Instance protocol. 
 
 =cut
 
@@ -132,9 +137,10 @@ BEGIN {
     extends 'Moose::Meta::Class';    
     
     override 'construct_instance' => sub {
-        my ($class, %params) = @_;
-        return $class->get_meta_instance->find_instance($params{oid}) 
-            if $params{oid};
+        my $class = shift;
+        my $params = @_ == 1 ? $_[0] : {@_};
+        return $class->get_meta_instance->find_instance($params->{oid}) 
+            if $params->{oid};
         super();
     };
 
@@ -431,4 +437,3 @@ Moose::POOP::Meta::Instance->_reload_db();
     
 }
 
-unlink('newswriter.db') if -e 'newswriter.db';
\ No newline at end of file