Skip to content

class :isa does not require parent class with hierarchical naming #21332

Closed
@ntyni

Description

@ntyni

This is a bug report for perl from [email protected],
generated with the help of perlbug 1.43 running under perl 5.39.2.


Description

If the class A::B inherits A with 'class A::B :isa(A)', A.pm does not
get loaded/required. This seems to be because of the hierarchical naming:
class B :isa(A) loads A.pm just fine.

I don't see a mention of this in the documentation, and Object::Pad
does not exhibit the same behaviour FWIW.

Explicitly loading A first (with e.g. 'use A') seems to be a workaround.

Steps to Reproduce

% cat lib/A.pm
use feature 'class';
class A {};
1;
% cat lib/A/B.pm
use feature 'class';
class A::B :isa(A) {};
1;
% perl -Ilib -c lib/A/B.pm; echo $?
class is experimental at lib/A/B.pm line 2.
Class :isa attribute requires a class but "A" is not one at lib/A/B.pm line 2.
255

Expected behavior
A.pm should get loaded as described in perlclass.pod for :isa().


Flags

  • category=core
  • severity=low

Perl configuration

Site configuration information for perl 5.39.2:

Configured by ntyni at Mon Aug	7 18:05:37 BST 2023.

Summary of my perl5 (revision 5 version 39 subversion 2) configuration:
  Commit id: 4f06424962ba637e7daad1d020cdd9573a9acdda
  Platform:
    osname=linux
    osvers=6.1.0-3-amd64
    archname=x86_64-linux
    uname='linux carme 6.1.0-3-amd64 #1 smp preempt_dynamic debian 6.1.8-1 (2023-01-29) x86_64 gnulinux '
    config_args='-des -Dusedevel'
    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 -D_FORTIFY_SOURCE=2'
    optimize='-O2'
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='12.2.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 -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
    libc=/lib/x86_64-linux-gnu/libc.so.6
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.36'
  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'


---
@INC for perl 5.39.2:
    lib
    /usr/local/lib/perl5/site_perl/5.39.2/x86_64-linux
    /usr/local/lib/perl5/site_perl/5.39.2
    /usr/local/lib/perl5/5.39.2/x86_64-linux
    /usr/local/lib/perl5/5.39.2

---
Environment for perl 5.39.2:
    HOME=/home/ntyni
    LANG=C
    LANGUAGE (unset)
    LC_CTYPE=fi_FI.UTF-8
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/bin:/usr/bin:/bin:/usr/games
    PERL_BADLANG (unset)
    SHELL=/bin/zsh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions