Description
Module:
none
Description
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.
Steps to Reproduce
use v5.36;
use feature 'class';
class My::Example 1.234 {
field $x;
ADJUST {
$x = "Hello, world";
}
method print_message {
say $x;
}
}
in perl 5.36.0
Expected behavior
My::Example->new->print_message;
should have printed a message
It is very strange that use v5.36
is a reference in future versions that wouldn't actually work in 5.36
Perl configuration
# perl -V output goes here
Summary of my perl5 (revision 5 version 36 subversion 0) configuration:
Platform:
osname=linux
osvers=5.4.0-104-generic
archname=x86_64-linux
uname='linux e 5.4.0-104-generic #118-ubuntu smp wed mar 2 19:02:41 utc 2022 x86_64 x86_64 x86_64 gnulinux '
config_args='-de -Dprefix=/home/con/perl5/perlbrew/perls/perl-5.36.0 -Aeval:scriptdir=/home/con/perl5/perlbrew/perls/perl-5.36.0/bin'
hint=recommended
useposix=true
d_sigaction=define
useithreads=undef
usemultiplicity=undef
use64bitint=define
use64bitall=define
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
Compiler:
cc='cc'
ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
optimize='-O2'
cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
ccversion=''
gccversion='9.4.0'
gccosandvers=''
intsize=4
longsize=8
ptrsize=8
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=16
longdblkind=3
ivtype='long'
ivsize=8
nvtype='double'
nvsize=8
Off_t='off_t'
lseeksize=8
alignbytes=8
prototype=define
Linker and Libraries:
ld='cc'
ldflags =' -fstack-protector-strong -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib/x86_64-linux-gnu /usr/lib /usr/lib64
libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
libc=libc-2.31.so
so=so
useshrplib=false
libperl=libperl.a
gnulibc_version='2.31'
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=so
d_dlsymun=undef
ccdlflags='-Wl,-E'
cccdlflags='-fPIC'
lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'
Characteristics of this binary (from libperl):
Compile-time options:
HAS_TIMES
PERLIO_LAYERS
PERL_COPY_ON_WRITE
PERL_DONT_CREATE_GVSV
PERL_MALLOC_WRAP
PERL_OP_PARENT
PERL_PRESERVE_IVUV
USE_64_BIT_ALL
USE_64_BIT_INT
USE_LARGE_FILES
USE_LOCALE
USE_LOCALE_COLLATE
USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC
USE_LOCALE_TIME
USE_PERLIO
USE_PERL_ATOF
Built under linux
Compiled at Jun 3 2022 07:49:08
%ENV:
PERLBREW_HOME="/home/con/.perlbrew"
PERLBREW_MANPATH="/home/con/perl5/perlbrew/perls/perl-5.36.0/man"
PERLBREW_PATH="/home/con/perl5/perlbrew/bin:/home/con/perl5/perlbrew/perls/perl-5.36.0/bin"
PERLBREW_PERL="perl-5.36.0"
PERLBREW_ROOT="/home/con/perl5/perlbrew"
PERLBREW_SHELLRC_VERSION="0.87"
PERLBREW_VERSION="0.96"
@inc:
/home/con/perl5/perlbrew/perls/perl-5.36.0/lib/site_perl/5.36.0/x86_64-linux
/home/con/perl5/perlbrew/perls/perl-5.36.0/lib/site_perl/5.36.0
/home/con/perl5/perlbrew/perls/perl-5.36.0/lib/5.36.0/x86_64-linux
/home/con/perl5/perlbrew/perls/perl-5.36.0/lib/5.36.0