X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FManual%2FMethodModifiers.pod;h=5b21dd4310a77f87a79bd7306add1361454b06a7;hb=2cc6f9825ee943b379068b9e9d4938bbc84e0308;hp=661936b07fed87241cb5d1826f8fe5d5ddfbaab7;hpb=d67ce58f8d57e240ded1f1ebdf262456ce2ff5be;p=gitmo%2FMoose.git diff --git a/lib/Moose/Manual/MethodModifiers.pod b/lib/Moose/Manual/MethodModifiers.pod index 661936b..5b21dd4 100644 --- a/lib/Moose/Manual/MethodModifiers.pod +++ b/lib/Moose/Manual/MethodModifiers.pod @@ -67,14 +67,14 @@ Method modifiers have many uses. One very common use is in roles. This lets roles alter the behavior of methods in the classes that use them. See L for more information about roles. -Most of the modifiers are most useful in roles, so some of the -examples below are a bit artificial. They're intended to give you an -idea of how modifiers work, but may not be the most natural usage. +Since modifiers are mostly useful in roles, some of the examples below +are a bit artificial. They're intended to give you an idea of how +modifiers work, but may not be the most natural usage. =head1 BEFORE, AFTER, AND AROUND -Method modifiers can also be used to add behavior to a method that -Moose generates for you, such as an attribute accessor: +Method modifiers can be used to add behavior to a method that Moose +generates for you, such as an attribute accessor: has 'size' => ( is => 'rw' ); @@ -87,7 +87,7 @@ Moose generates for you, such as an attribute accessor: }; Another use for the before modifier would be to do some sort of -pre-checking on a method call. For example: +prechecking on a method call. For example: before 'size' => sub { my $self = shift; @@ -109,8 +109,8 @@ ignored. An around modifier is a bit more powerful than either a before or after modifier. It can modify the arguments being passed to the original method, and you can even decide to simply not call the -original method at all. Finally, you can modify the return value with -an around modifier. +original method at all. You can also modify the return value with an +around modifier. An around modifier receives the original method as its first argument, I the object, and finally any arguments passed to the method. @@ -194,7 +194,7 @@ subclassing and adding more content inside the document: my $xml = '' . $self->income . ''; $xml .= "\n"; - my $xml = '' . $self->expenses . ''; + $xml .= '' . $self->expenses . ''; $xml .= "\n"; $xml .= inner() || q{};