PPI::Exception(3) User Contributed Perl Documentation PPI::Exception(3)

# [NAME](#NAME)

PPI::Exception - The PPI exception base class

# [SYNOPSIS](#SYNOPSIS)

```
  use PPI::Exception;
  
  my $e = PPI::Exception->new( 'something happened' );
  $e->throw;
  PPI::Exception->new( message => 'something happened' )->throw;
  PPI::Exception->throw( message => 'something happened' );
```

# [DESCRIPTION](#DESCRIPTION)

All exceptions thrown from within PPI will be instances or derivations of this class.

# [METHODS](#METHODS)

## [new $message | message =&gt; $message, ...](#new_$message___message_=__$message,_...)

Constructs and returns a new "PPI::Exception" object.

A message for the exception can be passed, either as a string or as "message =&gt; $message". The message is available via the "message" method.

## [throw](#throw)

If called on a "PPI::Exception" object, throws the object. If called on the class name, uses the arguments to construct a "PPI::Exception" and then throw it.

Each time the object is thrown, information from the Perl &lt;**caller**(0)&gt; call is saved and made available via the "callers" method.

This method never returns.

## [message](#message)

Returns the exception message passed to the object's constructor, or a default message.

## [callers](#callers)

Returns a listref, each element of which is a listref of caller(0) information. The returned listref can be empty.

2026-10-25 perl v5.44.0

---

Document: PPI::Exception(3pm) from perl-ppi 1.291-r2 (Chainguard OS)
Source: https://github.com/Perl-Critic/PPI
