GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Data::Object::Exception(3) User Contributed Perl Documentation Data::Object::Exception(3)

Data::Object::Exception

Exception Class for Perl 5

  use Data::Object::Exception;

  my $exception = Data::Object::Exception->new;

  # $exception->throw

This package provides functionality for creating, throwing, and introspecting exception objects.

This package supports the following scenarios:

  use Data::Object::Exception;

  my $exception = Data::Object::Exception->new('Oops!');

  # $exception->throw

The package allows objects to be instantiated with a single argument.

  use Data::Object::Exception;

  my $exception = Data::Object::Exception->new(message => 'Oops!');

  # $exception->throw

The package allows objects to be instantiated with key-value arguments.

This package has the following attributes:

  context(Any)

This attribute is read-only, accepts "(Any)" values, and is optional.

  id(Str)

This attribute is read-only, accepts "(Str)" values, and is optional.

  message(Str)

This attribute is read-only, accepts "(Str)" values, and is optional.

This package implements the following methods:

  explain() : Str

The explain method returns an error message with stack trace.

explain example #1
  use Data::Object::Exception;

  my $exception = Data::Object::Exception->new('Oops!');

  $exception->explain
    

  throw(Tuple[Str, Str] | Str $message, Any $context, Maybe[Number] $offset) : Any

The throw method throws an error with message (and optionally, an ID).

throw example #1
  use Data::Object::Exception;

  my $exception = Data::Object::Exception->new;

  $exception->throw('Oops!')
    
throw example #2
  use Data::Object::Exception;

  my $exception = Data::Object::Exception->new('Oops!');

  $exception->throw
    
throw example #3
  use Data::Object::Exception;

  my $exception = Data::Object::Exception->new;

  $exception->throw(['E001', 'Oops!'])
    

  trace(Int $offset, $Int $limit) : Object

The trace method compiles a stack trace and returns the object. By default it skips the first frame.

trace example #1
  use Data::Object::Exception;

  my $exception = Data::Object::Exception->new('Oops!');

  $exception->trace(0)
    
trace example #2
  use Data::Object::Exception;

  my $exception = Data::Object::Exception->new('Oops!');

  $exception->trace(1)
    
trace example #3
  use Data::Object::Exception;

  my $exception = Data::Object::Exception->new('Oops!');

  $exception->trace(0,1)
    

Al Newkirk, "awncorp@cpan.org"

Copyright (C) 2011-2019, Al Newkirk, et al.

This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file" <https://github.com/iamalnewkirk/data-object-exception/blob/master/LICENSE>.

Wiki <https://github.com/iamalnewkirk/data-object-exception/wiki>

Project <https://github.com/iamalnewkirk/data-object-exception>

Initiatives <https://github.com/iamalnewkirk/data-object-exception/projects>

Milestones <https://github.com/iamalnewkirk/data-object-exception/milestones>

Contributing <https://github.com/iamalnewkirk/data-object-exception/blob/master/CONTRIBUTE.md>

Issues <https://github.com/iamalnewkirk/data-object-exception/issues>

2020-03-14 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.