Skip Menu |

This queue is for tickets about the Syntax-Keyword-Try CPAN distribution.

Report information
The Basics
Id: 133422
Status: new
Priority: 0/
Queue: Syntax-Keyword-Try

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: A third typed catch block catch ( func($e) ) { ... }
catch ( func($e) ) { ... } Would just call func($e) and return a boolean. Could be useful for Type::Tiny libraries, MooseX::Types libraries, etc which export functions like is_Object, is_Str, etc. And for Ref::Util. Would also allow people to write their own custom tests like: sub isHttpException { my $e = shift; # Version 2 of the API return 1 if blessed($e) && $e->isa('Exception::HTTP'); # Legacy version 1 API return 1 if !ref($e) && $e =~ /^HTTP Error/; return 0; } try { $api->request(...); } catch ( isHttpException($e) ) { say "request failed; try again later"; } Maybe this strays too close to just allowing arbitrary expressions though. My request isn't for that. It's just to allow a simple one parameter function call to be used for typed catch blocks.