Debian Codegraph @

cpan/autodie/t/lib/Hints_test.pm

raw
1 package Hints_test;
2 use strict;
3 use warnings;
4
5 use Exporter 5.57 'import';
6
7 our @EXPORT_OK = qw(
8 fail_on_empty fail_on_false fail_on_undef
9 );
10
11 use autodie::hints;
12
13 # Create some dummy subs that just return their arguments.
14
15 sub fail_on_empty { return @_; }
16 sub fail_on_false { return @_; }
17 sub fail_on_undef { return @_; }
18
19 # Set them to different failure modes when used with autodie.
20
21 autodie::hints->set_hints_for(
22 \&fail_on_empty, {
23 list => autodie::hints::EMPTY_ONLY ,
24 scalar => autodie::hints::EMPTY_ONLY
25 }
26 );
27
28 autodie::hints->set_hints_for(
29 \&fail_on_false, {
30 list => autodie::hints::EMPTY_OR_FALSE ,
31 scalar => autodie::hints::EMPTY_OR_FALSE
32 }
33 );
34
35 autodie::hints->set_hints_for(
36 \&fail_on_undef, {
37 list => autodie::hints::EMPTY_OR_UNDEF ,
38 scalar => autodie::hints::EMPTY_OR_UNDEF
39 }
40 );
41
42 1;