NAME

Class::Superclasses - Find all (direct) superclasses of a class

VERSION

version 1.00

SYNOPSIS

  use Class::Superclasses;
  
  my $class_file = '/path/to/class_file.pm';
  my $parser = Class::Superclasses->new();
  $parser->document($class_file);
  my @superclasses = $parser->superclasses();
  
  print $_,"\n" for(@superclasses);

  # or pass a scalar ref that contains the code
  my $class_code = q~package Test; use base 'Baseclass';~;
  $parser->document(\$class_code);
  @superclasses = $parser->superclasses();
  
  print $_,"\n" for(@superclasses);

DESCRIPTION

Class::Superclasses uses PPI to get the superclasses of a class;

METHODS

new

creates a new object of Class::Superclasses.

  my $parser = Class::Superclasses->new();
  # or
  my $parser = Class::Superclasses->new($filename);

superclasses

returns in list context an array of all superclasses of the Perl class, in scalar context it returns an arrayref.

  my $arrayref = $parser->superclasses();
  my @array = $parser->superclasses();

document

tells Class::Superclasses which Perl class should be analyzed.

  $parser->document($filename);

AUTHOR

Renee Baecker <module@renee-baecker.de>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by Renee Baecker.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)