| 242 | | [hw; there's probably a golfier way] |
| 243 | | Perl has a few other provisions for this (e.g., WRAP), but if you want |
| 244 | | more control over invocation, you need to pass through the Capture but |
| 245 | | replace the invocant: |
| 246 | | |
| 247 | | method front_meth (\$args) { $:real_obj.back_meth( ??? ) } |
| 248 | | |
| 249 | | # [ does $obj.meth($args) ignore a prebound invocant? ] |
| | 242 | Perl 6 has a few other provisions for this (e.g., .wrap), but if you want |
| | 243 | more control over invocation, you can take advantage of the default Signature |
| | 244 | for methods, which puts all positionals in C<@_> and named arguments in C<%_>: |
| | 245 | |
| | 246 | method front_meth { |
| | 247 | $!real_obj.back_meth( *@_, *%_ ); |
| | 248 | } |
| | 249 | |
| | 250 | You can also take the argument list as a Capture object, and merge it with |
| | 251 | another method invocation: |
| | 252 | |
| | 253 | method front_meth (\$args) { |
| | 254 | $!real_obj_A.back_meth( *$args ); |
| | 255 | } |
| | 256 | |
| | 257 | This works because when there is already an invocant present, further |
| | 258 | invocants in the constructing argument list will be ignored. |