File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -258,16 +258,17 @@ L<Re-dispatching|/language/functions#Re-dispatching>.
258
258
259
259
You may write your own accessors to override any or all of the autogenerated ones.
260
260
261
+ my $ⲧ = " " xx 4;
261
262
class Journey {
262
263
has $.origin;
263
264
has $.destination;
264
265
has @.travelers;
265
266
has Str $.notes is rw;
266
267
267
268
multi method notes() { "$!notes\n" };
268
- multi method notes( Str $note ) { $!notes ~= "$note\n\t " };
269
+ multi method notes( Str $note ) { $!notes ~= "$note\n$ⲧ " };
269
270
270
- method Str { "⤷ $!origin\n\t " ~ self.notes() ~ "$!destination ⤶\n" };
271
+ method Str { "⤷ $!origin\n$ⲧ " ~ self.notes() ~ "$!destination ⤶\n" };
271
272
}
272
273
273
274
my $trip = Journey.new( :origin<Here>, :destination<There>,
@@ -277,13 +278,14 @@ You may write your own accessors to override any or all of the autogenerated one
277
278
$trip.notes("Almost there");
278
279
print $trip;
279
280
280
- # Will print
281
+ # OUTPUT:
281
282
#⤷ Here
282
- # First steps
283
- # Almost there
283
+ # First steps
284
+ # Almost there
284
285
#
285
286
#There ⤶
286
287
288
+
287
289
The declared multi method C < notes > overrides the auto-generated
288
290
methods implicit in the declaration of C < $.notes > , using a different
289
291
signature for reading and writing.
You can’t perform that action at this time.
0 commit comments