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
Future::Exception(3) User Contributed Perl Documentation Future::Exception(3)

"Future::Exception" - an exception type for failed Futures

   use Scalar::Util qw( blessed );
   use Syntax::Keyword::Try;

   try {
      my $f = ...;
      my @result = $f->result;
      ...
   }
   catch {
      if( blessed($@) and $@->isa( "Future::Exception" ) {
         print STDERR "The ", $@->category, " failed: ", $@->message, "\n";
      }
   }

The "get" method on a failed Future instance will throw an exception to indicate that the future failed. A failed future can contain a failure category name and other details as well as the failure message, so in this case the exception will be an instance of "Future::Exception" to make these values accessible.

Users should not depend on exact class name matches, but instead rely on inheritence, as a later version of this implementation might dynamically create subclasses whose names are derived from the Future failure category string, to assist with type matching. Note the use of "->isa" in the SYNOPSIS example.

   $e = Future::Exception->from_future( $f )

Constructs a new "Future::Exception" wrapping the given failed future.

   $message  = $e->message
   $category = $e->category
   @details  = $e->details

Additionally, the object will stringify to return the message value, for the common use-case of printing, regexp testing, or other behaviours.

   Future::Exception->throw( $message, $category, @details )

Since version 0.41.

Constructs a new exception object and throws it using "die()". This method will not return, as it raises the exception directly.

If $message does not end in a linefeed then the calling file and line number are appended to it, in the same way "die()" does.

   $f = $e->as_future

Returns a new "Future" object in a failed state matching the exception.

Paul Evans <leonerd@leonerd.org.uk>
2022-04-07 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.