6 Moose::Cookbook::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 print TPSReport->new->create # <page><header/><report type="tps"/><footer/></page>
75 Stevan Little E<lt>stevan@iinteractive.comE<gt>
77 =head1 COPYRIGHT AND LICENSE
79 Copyright 2007 by Infinity Interactive, Inc.
81 L<http://www.iinteractive.com>
83 This library is free software; you can redistribute it and/or modify
84 it under the same terms as Perl itself.