.+method makes an attempt to call all the methods with the given name on an object. This may be used, for example, when an instance is a part of the hierarchy of objects and its parent also has a method with the same name. More on the classes and class hierarchy in Chapter 4.
class A { Β Β Β method m($x) {"A::m($x)"} } class B is A { Β Β Β method m($x) {"B::m($x)"} }Β my $o = B.new; my @a = $o.+m(7); say @a; # Prints [B::m(7) A::m(7)]
Here, the $o object has the m method in both its own class B and in its parent class A. The $o.+m(7) calls both of the methods and puts their results in a list.
If the method is not defined, an exception will be thrown.