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?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=gitmo%2Fmoose-presentations.git 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?