Search code examples
perlperldoc

How to use perldoc to find documentation on "@ISA"?


I know this is a silly question. I have been using Perl now for about 2 months, and I'm interested in perldoc. I used man perldoc to find out how to use it, and tried to find documentation on the @ISA variable.

But when I do:

$perldoc -v @ISA

It says

No documentation for perl variable '@ISA' found

Am I using the perldoc right? Or do I need to install something?


Solution

  • perldoc -v checks perlvar, but @ISA isn't document there, unfortunately.

    @ISA is documented in perlobj. It's checked during method resolution to obtain a list of the class's parent classes.

    {
       package Base;
       sub new {
          my ($class) = @_;
          my $self = bless({}, $class);
          return $self;
       }
    
       sub do {
          print("do\n");
       }
    }
    
    {
       package Child;
       our @ISA = 'Base';
    }
    
    Child->new()->do();  # @ISA is consulted to locate "new" and "do".