perldoc > autodie::exception

📖 NAME

autodie::exception — Exceptions from autodying functions.

🚀 Quick Reference

Use CaseCommandDescription
🔍 Catch an autodie exception if (my $E = $@) { ... } Capture the exception object after an eval block.
📌 Identify the failing function $E->function Get the full subroutine name (e.g., CORE::open) that threw the error.
🎯 Match against a role or function $E->matches('open') Check if the exception matches a specific function or category (e.g., :file).

📋 SYNOPSIS

    eval {
        use autodie;

        open(my $fh, '<', 'some_file.txt');

        ...
    };

    if (my $E = $@) {
        say "Ooops!  ",$E->caller," had problems: $@";
    }

📝 DESCRIPTION

When an autodie enabled function fails, it generates an autodie::exception object. This can be interrogated to determine further information about the error that occurred.

This document is broken into two sections; those methods that are most useful to the end-developer, and those methods for anyone wishing to subclass or get very familiar with autodie::exception.

👥 Common Methods

These methods are intended to be used in the everyday dealing of exceptions.

The following assume that the error has been copied into a separate scalar:

    if ($E = $@) {
        ...
    }

This is not required, but is recommended in case any code is called which may reset or alter $@.

🔧 Advanced Methods

The following methods, while usable from anywhere, are primarily intended for developers wishing to subclass autodie::exception, write code that registers custom error messages, or otherwise work closely with the autodie::exception model.

🔗 SEE ALSO

autodie, autodie::exception::system

📄 LICENSE

Copyright (C)2008 Paul Fenwick

This is free software. You may modify and/or redistribute this code under the same terms as Perl 5.10 itself, or, at your option, any later version of Perl 5.

👤 AUTHOR

Paul Fenwick <pjf AT perltraining.au>

autodie::exception
📖 NAME 🚀 Quick Reference 📋 SYNOPSIS 📝 DESCRIPTION
👥 Common Methods 🔧 Advanced Methods
🔗 SEE ALSO 📄 LICENSE 👤 AUTHOR

Generated by phpman v4.9.26-5-g7740029 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-08-12 05:18 @2600:1f28:365:80b0:194e:56dd:d3a6:4135
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^