Nile/Say.pm

filter: Statementstmt 70.5% 36 / 51 Branchbran 20.0% 2 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 10 / 12 Podpod 0.0% 0 / 1 totaltotal 64.8% 48 / 74 CC 5 SCAR 13.1
CC
5
Cov
62%
say
11.0
import
2.0
__ANON__
2.0
CRAP 3.7
« Nile/Handler/FCGI.pm ↑ Summary Nile/Plugin/Minify/Perl.pm »
1 # Copyright Infomation
2 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 # Author : Dr. Ahmed Amin Elsheshtawy, Ph.D.
4 # Website: https://github.com/mewsoft/Nile, http://www.mewsoft.com
5 # Email : mewsoft@cpan.org, support@mewsoft.com
6 # Copyrights (c) 2014-2015 Mewsoft Corp. All rights reserved.
7 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 package Nile::Say;
9  
10 1 our $VERSION = '0.55';
11 1 our $AUTHORITY = 'cpan:MEWSOFT';
12  
13 =pod
14  
15 =encoding utf8
16  
17 =head1 NAME
18  
19 Nile::Say - Compatibility layer to use say().
20  
21 =head1 SYNOPSIS
22
23 print "hello world\n";
24  
25 # same as:
26  
27 say "hello world";
28  
29 =head1 DESCRIPTION
30  
31 Nile::Say - Compatibility layer to use say().
32  
33 =cut
34  
35 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
36 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 1 ▶use IO::Handle;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 1 ▶use Scalar::Util 'openhandle';
Subroutine BEGIN: called CC=1 SCAR=0.0
39 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
40  
41 # modified code from Say::Compat
42 24 ▶sub import {
Subroutine import: called CC=2 SCAR=7.1
43 24 my $class = shift;
44 24 my $caller = caller;
45  
46 24 ▶ if( $] < 5.010 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.01) { } 0 24 24
47 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
48 0 *{caller() . '::say'} = \&say;
49 1 ▶ use strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
50 }
51 else {
52 24 require feature;
53 24 feature->import("say");
54 }
55 }
56  
57 # code from Perl6::Say
58 0 ▶sub say {
Subroutine say: not called CC=4 SCAR=24.0
Pod undocumented
59 0 my $currfh = select();
60 0 my $handle;
61 {
62 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
63 0 ▶ $handle = openhandle($_[0]) ? shift : \*$currfh;
Branch: 1 branch
BranchTrueFalseTotal
&openhandle($_[0]) ? : 0 0 0
64 1 ▶ use strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
65 }
66 0 ▶ @_ = $_ unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
67 0 my $warning;
68 0 ▶ local $SIG{__WARN__} = sub { $warning = join q{}, @_ };
Subroutine __ANON__: not called CC=1 SCAR=6.9
69 0 my $res = print {$handle} @_, "\n";
70 0 ▶ return $res if $res;
Branch: 1 branch
BranchTrueFalseTotal
if $res 0 0 0
71 0 $warning =~ s/[ ]at[ ].*//xms;
72 0 croak $warning;
73 }
74  
75 # Handle OO calls:
76 1 ▶*IO::Handle::say = \&say if ! defined &IO::Handle::say;
Branch: 1 branch
BranchTrueFalseTotal
unless defined &IO::Handle::say 0 1 1
77  
78  
79 =pod
80  
81 =head1 Bugs
82  
83 This project is available on github at L<https://github.com/mewsoft/Nile>.
84  
85 =head1 HOMEPAGE
86  
87 Please visit the project's homepage at L<https://metacpan.org/release/Nile>.
88  
89 =head1 SOURCE
90  
91 Source repository is at L<https://github.com/mewsoft/Nile>.
92  
93 =head1 SEE ALSO
94  
95 See L<Nile> for details about the complete framework.
96  
97 =head1 AUTHOR
98  
99 Ahmed Amin Elsheshtawy, احمد امين الششتاوى <mewsoft@cpan.org>
100 Website: http://www.mewsoft.com
101  
102 =head1 COPYRIGHT AND LICENSE
103  
104 Copyright (C) 2014-2015 by Dr. Ahmed Amin Elsheshtawy احمد امين الششتاوى mewsoft@cpan.org, support@mewsoft.com,
105 L<https://github.com/mewsoft/Nile>, L<http://www.mewsoft.com>
106  
107 This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
108  
109 =cut
110  
111 1 1;
« Nile/Handler/FCGI.pm ↑ Summary Nile/Plugin/Minify/Perl.pm »