The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Try::Tiny::Tiny - slim Try::Tiny down as far as reasonably possible


 export PERL5OPT=-MTry::Tiny::Tiny


This module slims down Try::Tiny as much as possible, currently by preventing Try::Tiny from giving somewhat more human-friendly names to the code references it is passed.

This is done by blocking Try::Tiny from finding any of the utility modules it needs for this feature. As a result, you must use this module before using any other module that loads Try::Tiny. In practice that means you probably want to load it as early as possible, such as through PERL5OPT.



Try::Tiny is very heavy compared to raw eval. It is also used all across the CPAN. You yourself could avoid using it in your own code (and if you write CPAN modules, please do), but your applications will almost invariably wind up loading it anyway due to its pervasive use. It is not likely to be feasible to completely avoid depending on it, nor to send patches to remove it from every one of your dependencies (and then get all of the patches accepted).

With this module, you can at least sanitise your dependency chain a little, without patching anything.

Current effect

There are several reasons to not want Try::Tiny to name the coderefs it is passed: it takes meaningful time on every invocation, and it requires modules that may otherwise not have been loaded, yet it is useful only in stack traces, and then only to a human looking at the stack trace directly, whereas other code may be impeded in examining the stack (e.g. to print more helpful error messages in certain scenarios).


This module will fail to load if you load it too late to take effect.


Try::Catch – a stripped-down clone of Try::Tiny


Aristotle Pagaltzis <>


This software is copyright (c) 2017 by Aristotle Pagaltzis.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.