File Coverage

blib/lib/Run/Parts/Common.pm
Criterion Covered Total %
statement 14 14 100.0
branch 6 6 100.0
condition n/a
subroutine 5 5 100.0
pod 2 2 100.0
total 27 27 100.0


line stmt bran cond sub pod time code
1             package Run::Parts::Common;
2              
3             # ABSTRACT: Common helpers for Run::Parts and its backends
4              
5 5     5   13 use Modern::Perl;
  5         5  
  5         18  
6 5     5   1198 use Exporter::Easy ( EXPORT => [qw[lines chomped_lines]] );
  5         3697  
  5         19  
7 5     5   424 use Scalar::Util qw(blessed);
  5         5  
  5         597  
8              
9             our $VERSION = '0.06_90'; # VERSION generated by DZP::OurPkgVersion
10              
11              
12             sub lines {
13             # Sanity check
14 65 100   65 1 1162 die "lines is no method" if blessed $_[0];
15              
16 64 100       956 return wantarray ? @_ : join("\n", @_)."\n";
17             }
18              
19              
20             sub chomped_lines {
21             # Sanity check
22 27 100   27 1 1515 die "chomped_lines is no method" if blessed $_[0];
23              
24 26         97 chomp(@_);
25 26         87 return lines(@_);
26             }
27              
28              
29              
30              
31             23; # End of Run::Parts::Common
32              
33             __END__
34              
35             =pod
36              
37             =encoding UTF-8
38              
39             =head1 NAME
40              
41             Run::Parts::Common - Common helpers for Run::Parts and its backends
42              
43             =head1 VERSION
44              
45             version 0.06_90
46              
47             =head1 SYNOPSIS
48              
49             Exports helper functions used by L<Run::Parts> as well as its backends.
50              
51             =head1 EXPORTED FUNCTIONS
52              
53             =head2 lines
54              
55             Gets an array of strings as parameter.
56              
57             In scalar context returns a string with all lines concatenated. In
58             array context it passes through the array.
59              
60             =head2 chomped_lines
61              
62             Gets an array of strings as parameter and calls chomp() on it.
63              
64             In scalar context returns a string with all lines concatenated. In
65             array context it passes through the array.
66              
67             =head1 SEE ALSO
68              
69             L<Run::Parts>
70              
71             =head1 BUGS
72              
73             Please report any bugs or feature requests to C<bug-run-parts at
74             rt.cpan.org>, or through the web interface at
75             L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Run-Parts>. I will
76             be notified, and then you'll automatically be notified of progress on
77             your bug as I make changes.
78              
79             =head1 AUTHOR
80              
81             Axel Beckert <abe@deuxchevaux.org>
82              
83             =head1 COPYRIGHT AND LICENSE
84              
85             This software is copyright (c) 2014 by Axel Beckert.
86              
87             This is free software; you can redistribute it and/or modify it under
88             the same terms as the Perl 5 programming language system itself.
89              
90             =cut