5ddd267978ea5e0c03ccfc5a188e79e5ca4d6c4e
[gitmo/Moose.git] / lib / Moose / Cookbook / Recipe3.pod
1
2 =pod
3
4 =head1 NAME
5
6 Moose::Cookbook::Recipe3
7
8 =head1 SYNOPSIS
9
10   package BinaryTree;
11   use strict;
12   use warnings;
13   use Moose;
14   
15   has 'parent' => (
16           is        => 'rw',
17           isa       => 'BinaryTree',    
18       predicate => 'has_parent',
19           weak_ref  => 1,
20   );
21   
22   has 'left' => (
23           is        => 'rw',    
24           isa       => 'BinaryTree',            
25       predicate => 'has_left',         
26   );
27   
28   has 'right' => (
29           is        => 'rw',    
30           isa       => 'BinaryTree',            
31       predicate => 'has_right',           
32   );
33   
34   before 'right', 'left' => sub {
35       my ($self, $tree) = @_;
36       $tree->parent($self) if defined $tree;   
37   };
38
39 =head1 DESCRIPTION
40
41 =head1 AUTHOR
42
43 Stevan Little E<lt>stevan@iinteractive.comE<gt>
44
45 =head1 COPYRIGHT AND LICENSE
46
47 Copyright 2006 by Infinity Interactive, Inc.
48
49 L<http://www.iinteractive.com>
50
51 This library is free software; you can redistribute it and/or modify
52 it under the same terms as Perl itself.
53
54 =cut