This is not the correct explanation. Deparse helps:
unexpected OP_METHSTART at /usr/share/perl5/B/Deparse.pm line 1674.
unexpected OP_METHSTART at /usr/share/perl5/B/Deparse.pm line 1674.
sub BEGIN {
require v5.38.0;
()
}
use warnings;
use strict;
no feature ':all';
use feature ':5.38';
use experimental ('class');
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x5
+5\x55\x55\x55\x55\x55\x55\x55\x55\x51\x55"}
use feature 'class';
{
package Gear;
;
sub ratio : method {
XXX;
return $chainring / $cog;
}
sub gear_inches : method {
XXX;
return ratio(*$rim + $tire * 2);
}
}
say 'Gear'->new('chainring', 52, 'cog', 11, 'rim', 26, 'tire', 1.5)->g
+ear_inches;
(I had to modify the code a bit because I don't have 5.40)
So it takes everything that comes after the method name as the argument, so the * is interpreted as a glob dereference.
Note that B::Deparse also struggles with the new class feature.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|