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

NAME

Eval::Util - Utilities related to eval()

VERSION

This document describes version 0.001 of Eval::Util (from Perl distribution Eval-Util), released on 2018-03-05.

SYNOPSIS

 use Eval::Util qw(inside_eval);

 eval { say "foo" if inside_eval() };
 say "bar" if inside_eval();
 # will print C<foo> but not C<bar>.

DESCRIPTION

FUNCTIONS

None exported by default, but they are exportable.

inside_eval

Usage: inside_eval() => bool

Will check if running code is inside eval() (either string eval or block eval). This is done via examining the stack trace and checking for frame with subroutine named (eval).

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Eval-Util.

SOURCE

Source repository is at https://github.com/perlancar/perl-Eval-Util.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Eval-Util

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

caller in perlfunc

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by perlancar@cpan.org.

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