1package my::autodie;
2use strict;
3use warnings;
4
5use base qw(autodie);
6use autodie::exception;
7use autodie::hints;
8
9autodie::hints->set_hints_for(
10    'Some::Module::some_sub' => {
11        scalar => sub { 1 },        # No calling in scalar/void context
12        list   => sub { @_ == 2 and not defined $_[0] }
13    },
14);
15
16autodie::exception->register(
17    'Some::Module::some_sub' => sub {
18        my ($E) = @_;
19
20        if ($E->context eq "scalar") {
21            return "some_sub() can't be called in scalar context";
22        }
23
24        my $error = $E->return->[1];
25
26        return "some_sub() failed: $error";
27    }
28);
29
301;
31