File Coverage

blib/lib/Text/VisualPrintf/IO.pm
Criterion Covered Total %
statement 26 28 92.8
branch 1 2 50.0
condition n/a
subroutine 8 8 100.0
pod n/a
total 35 38 92.1


line stmt bran cond sub pod time code
1             package Text::VisualPrintf::IO;
2              
3 5     5   683942 use v5.10;
  5         21  
4 5     5   40 use strict;
  5         10  
  5         181  
5 5     5   47 use warnings;
  5         14  
  5         429  
6              
7 5     5   3731 use IO::Handle;
  5         49734  
  5         340  
8 5     5   2424 use Text::VisualPrintf;
  5         106  
  5         808  
9              
10             our @EXPORT_OK = qw(printf vprintf);
11              
12             sub import {
13 5     5   76 my $pkg = shift;
14 5         26 for my $func (@_) {
15 8 50       20 unless (grep { $func eq $_ } @EXPORT_OK) {
  16         56  
16 0         0 require Carp;
17 0         0 Carp::croak "\"$func\" is not exported";
18             }
19 5     5   55 no strict 'refs';
  5         10  
  5         244  
20 5     5   30 no warnings 'once', 'redefine';
  5         15  
  5         812  
21 8         16 *{"IO::Handle::$func"} = \&Text::VisualPrintf::printf;
  8         2288  
22             }
23             }
24              
25             1;
26              
27             __END__