PPI::Exception(3pm)

PPI::Exception3pm

The ppi exception base class

Usage

  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' );

Overview

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

Methods

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 => $message". The message is available via the "message" method.

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 <caller(0)> call is saved and made available via the "callers" method.

This method never returns.

message

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

callers

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

Releases

5 releases since Debian 10 (Buster); the text changed 4 times.

  1. 10
  2. 11
  3. 12
  4. 13
  5. Arch

From perl-ppi 1.291-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.