File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -243,9 +243,20 @@ public attributes of that class.
243
243
my $c = C.new.a = 42;
244
244
dd $c; # OUTPUT « Int $c = 42 »
245
245
246
- = head3 trait C < is required >
246
+ = head3 X « trait C < is required > |is required »
247
247
248
- TODO
248
+ Defined as:
249
+
250
+ multi sub trait_mod:<is>(Attribute $attr, :$required!)
251
+
252
+ Marks a class or roles attribute as required. If the attribute is not
253
+ initialized at object construction time throws
254
+ L < X::Attribute::Required|/type/X::Attribute::Required > .
255
+
256
+ class C { has $.attr is required; }
257
+ C.new;
258
+ CATCH { default { say .^name => .Str } }
259
+ # OUTPUT « X::Attribute::Required => The attribute '$!attr' is required, but you did not provide a value for it. »
249
260
250
261
= head3 trait C < does >
251
262
You can’t perform that action at this time.
0 commit comments