Ask/Functions.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 50 CC 1 SCAR 6.9
CC
1
Cov
0%
_exporter_validate_opts
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 use 5.008008;
2 use strict;
3 use warnings;
4  
5 package Ask::Functions;
6  
7 our $AUTHORITY = 'cpan:TOBYINK';
8 our $VERSION = '0.015';
9  
10 use Exporter::Shiny qw(
11 info warning error entry question file_selection
12 single_choice multiple_choice
13 );
14  
15 sub _exporter_validate_opts {
16 my ( $class, $opts ) = @_;
17
18 $opts->{'backend'} ||= do { require Ask; 'Ask'->detect };
19 $opts->{'backend'}->is_usable or die;
20 }
21  
22 for my $f ( our @EXPORT_OK ) {
23 no strict 'refs';
24 *{"_generate_$f"} = sub {
25 my ( $class, $name, $args, $opts ) = @_;
26 my $backend = $opts->{'backend'};
27 return sub { $backend->$f( @_ % 2 ? ( text => @_ ) : @_ ) };
28 };
29 }
30  
31 1;
32  
33 __END__