I'm taking an example from Perl's documentation:
https://perldoc.perl.org/blead/perlclass
and trying to execute the following script:
use v5.36;
use feature 'class';
class My::Example 1.234 {
field $x;
ADJUST {
$x = "Hello, world";
}
method print_message {
say $x;
}
}
My::Example->new->print_message;
but I get this error:
Feature "class" is not supported by Perl 5.36.0 at /home/con/Scripts/class.pl line 4.
BEGIN failed--compilation aborted at /home/con/Scripts/class.pl line 4.
Command exited with non-zero status 255
I'm copying the script exactly from the manual, yet the script doesn't work.
Is this a bug, or am I doing something wrong?
From your link:
You are viewing the version of this documentation from Perl blead. This is a development version of Perl.
If your code does not run, then you are likely using a different version of Perl. Perhaps you have the standard version of 5.36.1, which is currently the version documented by this link: