line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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
|
|
|
|
|
|
|
our $VERSION = '0.55'; |
11
|
|
|
|
|
|
|
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
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
36
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
37
|
1
|
|
|
1
|
|
3
|
use IO::Handle; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
40
|
|
38
|
1
|
|
|
1
|
|
4
|
use Scalar::Util 'openhandle'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
39
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
70
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# modified code from Say::Compat |
42
|
|
|
|
|
|
|
sub import { |
43
|
24
|
|
|
24
|
|
2475
|
my $class = shift; |
44
|
24
|
|
|
|
|
79
|
my $caller = caller; |
45
|
|
|
|
|
|
|
|
46
|
24
|
50
|
|
|
|
76
|
if( $] < 5.010 ) { |
47
|
1
|
|
|
1
|
|
4
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
44
|
|
48
|
0
|
|
|
|
|
0
|
*{caller() . '::say'} = \&say; |
|
0
|
|
|
|
|
0
|
|
49
|
1
|
|
|
1
|
|
4
|
use strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
65
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
else { |
52
|
24
|
|
|
|
|
139
|
require feature; |
53
|
24
|
|
|
|
|
1607
|
feature->import("say"); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# code from Perl6::Say |
58
|
|
|
|
|
|
|
sub say { |
59
|
0
|
|
|
0
|
0
|
|
my $currfh = select(); |
60
|
0
|
|
|
|
|
|
my $handle; |
61
|
|
|
|
|
|
|
{ |
62
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
40
|
|
|
0
|
|
|
|
|
|
|
63
|
0
|
0
|
|
|
|
|
$handle = openhandle($_[0]) ? shift : \*$currfh; |
64
|
1
|
|
|
1
|
|
4
|
use strict 'refs'; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
152
|
|
65
|
|
|
|
|
|
|
} |
66
|
0
|
0
|
|
|
|
|
@_ = $_ unless @_; |
67
|
0
|
|
|
|
|
|
my $warning; |
68
|
0
|
|
|
0
|
|
|
local $SIG{__WARN__} = sub { $warning = join q{}, @_ }; |
|
0
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
my $res = print {$handle} @_, "\n"; |
|
0
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
|
return $res if $res; |
71
|
0
|
|
|
|
|
|
$warning =~ s/[ ]at[ ].*//xms; |
72
|
0
|
|
|
|
|
|
croak $warning; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# Handle OO calls: |
76
|
|
|
|
|
|
|
*IO::Handle::say = \&say if ! defined &IO::Handle::say; |
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; |