From: Dave Rolsky Date: Fri, 7 Jun 2013 03:57:23 +0000 (-0500) Subject: Add another init_arg example X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2Fmoose-presentations.git;a=commitdiff_plain;h=HEAD Add another init_arg example --- diff --git a/moose-class/slides/index.html b/moose-class/slides/index.html index e8302e4..f271e01 100644 --- a/moose-class/slides/index.html +++ b/moose-class/slides/index.html @@ -2001,6 +2001,26 @@ Person->new( shoes => Shoes->new );
+

Some More init_arg examples

+ + + +
package Person;
+use Moose;
+
+has _size => (
+    is       => 'ro',
+    init_arg => 'size',
+);
+
+my $person = Person->new( size => 42 );
+
+$person->size(); # error
+
+ +

Why Set init_arg => undef?