Redid conversion to Test::Fatal
[gitmo/Moose.git] / lib / Moose / Cookbook / Basics / Recipe3.pod
index 9ddb624..84e7da5 100644 (file)
@@ -63,8 +63,7 @@ Let's take a look at the C<node> attribute:
   has 'node' => ( is => 'rw', isa => 'Any' );
 
 Moose generates a read-write accessor for this attribute. The type
-constraint is C<Any>, which means literally means it can contain
-anything.
+constraint is C<Any>, which literally means it can contain anything.
 
 We could have left out the C<isa> option, but in this case, we are
 including it for the benefit of other programmers, not the computer.
@@ -118,7 +117,7 @@ exception. (2)
 In the second recipe the B<BankAccount>'s C<balance> attribute had a
 default value of C<0>. Given a non-reference, Perl copies the
 I<value>. However, given a reference, it does not do a deep clone,
-instead simply copying the reference. If you just specified a simply
+instead simply copying the reference. If you just specified a simple
 reference for a default, Perl would create it once and it would be
 shared by all objects with that attribute.
 
@@ -211,7 +210,7 @@ You I<can> use the C<default> option without the C<lazy> option if you
 like, as we showed in the second recipe.
 
 Also, you can use C<builder> instead of C<default>. See
-L<Moose::Cookbook::Basics::Recipe9> for details.
+L<Moose::Cookbook::Basics::Recipe8> for details.
 
 =back
 
@@ -223,7 +222,7 @@ Dave Rolsky E<lt>autarch@urth.orgE<gt>
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2006-2009 by Infinity Interactive, Inc.
+Copyright 2006-2010 by Infinity Interactive, Inc.
 
 L<http://www.iinteractive.com>
 
@@ -262,9 +261,13 @@ ok(!$left->has_right, '... $left no right node yet');
 
 is($left->node, undef, '... left has got no node value');
 
-lives_ok {
-    $left->node('left')
-} '... assign to lefts node';
+is(
+    exception {
+        $left->node('left');
+    },
+    undef,
+    '... assign to lefts node'
+);
 
 is($left->node, 'left', '... left now has a node value');
 
@@ -279,9 +282,13 @@ ok($root->has_right, '... now we have a right node');
 my $right = $root->right;
 isa_ok($right, 'BinaryTree');
 
-lives_ok {
-    $right->node('right')
-} '... assign to rights node';
+is(
+    exception {
+        $right->node('right');
+    },
+    undef,
+    '... assign to rights node'
+);
 
 is($right->node, 'right', '... left now has a node value');
 
@@ -311,9 +318,13 @@ ok(isweak($left_left->{parent}), '... parent is a weakened ref');
 my $left_right = BinaryTree->new;
 isa_ok($left_right, 'BinaryTree');
 
-lives_ok {
-    $left->right($left_right)
-} '... assign to rights node';
+is(
+    exception {
+        $left->right($left_right);
+    },
+    undef,
+    '... assign to rights node'
+);
 
 ok($left_right->has_parent, '... left does have a parent');
 
@@ -325,9 +336,13 @@ ok(isweak($left_right->{parent}), '... parent is a weakened ref');
 
 # and check the error
 
-dies_ok {
-    $left_right->right($left_left)
-} '... cant assign a node which already has a parent';
+isnt(
+    exception {
+        $left_right->right($left_left);
+    },
+    undef,
+    '... cannot assign a node which already has a parent'
+);
 
 =end testing