From 4345aceaada5add3ef524c52934fa236bf305450 Mon Sep 17 00:00:00 2001 From: Chris Weyl Date: Fri, 13 Mar 2015 09:58:01 -0700 Subject: [PATCH] Group builder shortcut docs together ...because my brain likes things grouped logically, and has decided this is the new logic. --- lib/MooseX/AttributeShortcuts.pm | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/MooseX/AttributeShortcuts.pm b/lib/MooseX/AttributeShortcuts.pm index 101f27b..fcf767e 100644 --- a/lib/MooseX/AttributeShortcuts.pm +++ b/lib/MooseX/AttributeShortcuts.pm @@ -514,6 +514,21 @@ Specifying C 1> will cause the following options to be set: builder => "_build_$name" +=head2 builder => sub { ... } + +Passing a coderef to builder will cause that coderef to be installed in the +class this attribute is associated with the name you'd expect, and +C 1> to be set. + +e.g., in your class, + + has foo => (is => 'ro', builder => sub { 'bar!' }); + +...is effectively the same as... + + has foo => (is => 'ro', builder => '_build_foo'); + sub _build_foo { 'bar!' } + =head2 clearer => 1 Specifying C 1> will cause the following options to be set: @@ -556,21 +571,6 @@ For an attribute named "_foo": This naming scheme, in which the trigger is always private, is the same as the builder naming scheme (just with a different prefix). -=head2 builder => sub { ... } - -Passing a coderef to builder will cause that coderef to be installed in the -class this attribute is associated with the name you'd expect, and -C 1> to be set. - -e.g., in your class, - - has foo => (is => 'ro', builder => sub { 'bar!' }); - -...is effectively the same as... - - has foo => (is => 'ro', builder => '_build_foo'); - sub _build_foo { 'bar!' } - =head2 isa_instance_of => ... Given a package name, this option will create an C type constraint that