# perldoc > Class::Inspector

---
type: CommandReference
command: Class::Inspector
mode: perldoc
section: ''
source: perldoc
---

## Quick Reference

- `Class::Inspector->installed($class)` — check if class is installed/available
- `Class::Inspector->loaded($class)` — check if class is loaded in symbol table
- `Class::Inspector->filename($class)` — get base filename (e.g., `Foo/Bar.pm`)
- `Class::Inspector->resolved_filename($class)` — fully resolved filename from `@INC`
- `Class::Inspector->functions($class)` — list function names in class namespace
- `Class::Inspector->methods($class, @options)` — list all methods available to class (including inheritance)
- `Class::Inspector->subclasses($class)` — find all loaded subclasses of a class

## Name

Get information about a class and its structure

## Synopsis

perl
use Class::Inspector;

# Is a class installed and/or loaded
Class::Inspector->installed('Foo::Class');
Class::Inspector->loaded('Foo::Class');

# Filename related information
Class::Inspector->filename('Foo::Class');
Class::Inspector->resolved_filename('Foo::Class');

# Get subroutine related information
Class::Inspector->functions('Foo::Class');
Class::Inspector->function_refs('Foo::Class');
Class::Inspector->function_exists('Foo::Class', 'bar');
Class::Inspector->methods('Foo::Class', 'full', 'public');

# Find all loaded subclasses
Class::Inspector->subclasses('Foo::Class');
## Description

`Class::Inspector` provides a friendly interface to get information about a loaded class. It wraps low-level Perl symbol table introspection to answer common questions such as whether a class is installed, where its file is located, what functions or methods it provides, and which subclasses exist.

## Methods

- `installed($class)` — Returns true if the class is available to Perl (via `resolved_filename`), false if not, or `undef` if the class name is invalid.
- `loaded($class)` — Returns true if the class is loaded (by checking symbol table entries), false if not, or `undef` if invalid. Works even for classes without their own file.
- `filename($class)` — Returns the base filename of the class relative to `@INC` (e.g., `Foo/Bar.pm`), or `undef` if invalid.
- `resolved_filename($class, @try_first)` — Returns the fully resolved filename for the class from `@INC` (not necessarily the loaded file). Returns `undef` if invalid.
- `loaded_filename($class)` — Returns the actual file path from which the class was loaded (via `%INC`), or false if the class had no own file.
- `functions($class)` — Returns a reference to an array of all function names in the class's immediate namespace (not methods). Returns `undef` if the class is not loaded or invalid.
- `function_refs($class)` — Returns a reference to an array of CODE references to all functions in the class's immediate namespace. Returns `undef` if not loaded.
- `function_exists($class, $function)` — Returns true if the function exists in the class (as a function, not a method), false if not, or `undef` if invalid or not loaded.
- `methods($class, @options)` — Returns ALL methods available to the class, including inherited ones. Returns a reference to an array of method names, or `undef` if invalid or not loaded. Options:
  - `public` — Return only methods that do not start with an underscore.
  - `private` — Return only methods that start with an underscore.
  - `full` — Return method names as fully qualified (e.g., `Class::method1`).
  - `expanded` — Return an array of arrays: `[ full_name, class, method, \&code ]`.
- `subclasses($class)` — Searches all loaded classes for those that are subclasses of the given class (via `isa`). Returns a reference to an array of class names, false if none, or `undef` if invalid.

## See Also

- [Class::Inspector](https://metacpan.org/pod/Class::Inspector) on CPAN
- [Class::Handle](https://metacpan.org/pod/Class::Handle)
- [Class::Inspector::Functions](https://metacpan.org/pod/Class::Inspector::Functions)