From: Stevan Little Date: Thu, 2 Aug 2007 19:09:32 +0000 (+0000) Subject: foo X-Git-Tag: 0_25~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a909a4df0e7745c3d375815811625cadb6882ebf;p=gitmo%2FMoose.git foo --- diff --git a/Changes b/Changes index 7c6622c..81af1f7 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,10 @@ Revision history for Perl extension Moose 0.25 + * Moose::Cookbook::Recipe7 + - added new recipe for augment/inner functionality + - added test for this + * Moose::Meta::Attribute - required attributes now will no longer accept undef from the constructor, even if there is a default and lazy @@ -8,6 +12,13 @@ Revision history for Perl extension Moose - default subroutines must return a value which passes the type constraint - added tests for this + + * Moose::Meta::Attribute + * Moose::Meta::Method::Constructor + * Moose::Meta::Method::Accessor + - type-constraint tests now handle overloaded objects correctly + in the error message + - added tests for this (thanks to EvanCarroll) * Moose::Meta::Role - massive refactoring of this code diff --git a/lib/Moose/Cookbook/Recipe7.pod b/lib/Moose/Cookbook/Recipe7.pod new file mode 100644 index 0000000..f53df9c --- /dev/null +++ b/lib/Moose/Cookbook/Recipe7.pod @@ -0,0 +1,82 @@ + +=pod + +=head1 NAME + +Moose::Cookbook::Recipe7 - The augment/inner example + +=head1 SYNOPSIS + + package Document::Page; + use Moose; + + 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 open_page { (shift)->append_body('') } + sub open_page { (shift)->append_body('') } + + package MyDocument::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('