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