6 Moose::Cookbook::Basics::Recipe6 - The augment/inner example
10 package Document::Page;
13 has 'body' => ( is => 'rw', isa => 'Str', default => sub {''} );
23 my ( $self, $appendage ) = @_;
24 $self->body( $self->body . $appendage );
27 sub open_page { (shift)->append_body('<page>') }
28 sub close_page { (shift)->append_body('</page>') }
30 package Document::PageWithHeadersAndFooters;
33 extends 'Document::Page';
35 augment 'create' => sub {
42 sub create_header { (shift)->append_body('<header/>') }
43 sub create_footer { (shift)->append_body('<footer/>') }
48 extends 'Document::PageWithHeadersAndFooters';
50 augment 'create' => sub {
52 $self->create_tps_report;
55 sub create_tps_report {
56 (shift)->append_body('<report type="tps"/>');
59 # <page><header/><report type="tps"/><footer/></page>
60 print TPSReport->new->create;
76 Stevan Little E<lt>stevan@iinteractive.comE<gt>
78 =head1 COPYRIGHT AND LICENSE
80 Copyright 2007 by Infinity Interactive, Inc.
82 L<http://www.iinteractive.com>
84 This library is free software; you can redistribute it and/or modify
85 it under the same terms as Perl itself.