X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FCookbook%2FBasics%2FRecipe6.pod;h=a46e4c023314d1cfdca3a6a187c466240d1e6692;hb=ccea63ce44db05da6bbc1a51a136ead4c275f8e4;hp=bce383d66450c8c65d5a42f5503b4cc7e8273f2c;hpb=021b8139fcacfbd1c0d4dc26e07936457f1ba12b;p=gitmo%2FMoose.git diff --git a/lib/Moose/Cookbook/Basics/Recipe6.pod b/lib/Moose/Cookbook/Basics/Recipe6.pod index bce383d..a46e4c0 100644 --- a/lib/Moose/Cookbook/Basics/Recipe6.pod +++ b/lib/Moose/Cookbook/Basics/Recipe6.pod @@ -6,81 +6,131 @@ Moose::Cookbook::Basics::Recipe6 - The augment/inner example =head1 SYNOPSIS - + package Document::Page; use Moose; - - has 'body' => (is => 'rw', isa => 'Str', default => sub {''}); - + + has 'body' => ( is => 'rw', isa => 'Str', default => sub {''} ); + sub create { my $self = shift; $self->open_page; inner(); $self->close_page; } - - sub append_body { - my ($self, $appendage) = @_; - $self->body($self->body . $appendage); + + sub append_body { + my ( $self, $appendage ) = @_; + $self->body( $self->body . $appendage ); } - + sub open_page { (shift)->append_body('') } - sub close_page { (shift)->append_body('') } - + sub close_page { (shift)->append_body('') } + package Document::PageWithHeadersAndFooters; use Moose; - + extends 'Document::Page'; - + augment 'create' => sub { my $self = shift; $self->create_header; inner(); $self->create_footer; }; - + sub create_header { (shift)->append_body('
') } - sub create_footer { (shift)->append_body('