line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#ABSTRACT: Pragma qbit |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 Name |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
qbit - Setup envirement to development modern perl applications and add some functions. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 Description |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Using this pragma is equivalent: |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use strict; |
12
|
|
|
|
|
|
|
use warnings FATAL => 'all'; |
13
|
|
|
|
|
|
|
use utf8; |
14
|
|
|
|
|
|
|
use open qw(:std utf8); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use Scalar::Util qw(set_prototype blessed dualvar isweak readonly refaddr reftype tainted weaken isvstring looks_like_number); |
17
|
|
|
|
|
|
|
use Data::Dumper qw(Dumper); |
18
|
|
|
|
|
|
|
use Clone qw(clone); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use qbit::Exceptions; |
21
|
|
|
|
|
|
|
use qbit::Log; |
22
|
|
|
|
|
|
|
use qbit::Array; |
23
|
|
|
|
|
|
|
use qbit::Hash; |
24
|
|
|
|
|
|
|
use qbit::GetText; |
25
|
|
|
|
|
|
|
use qbit::Packages; |
26
|
|
|
|
|
|
|
use qbit::StringUtils; |
27
|
|
|
|
|
|
|
use qbit::Date; |
28
|
|
|
|
|
|
|
use qbit::File; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 Synopsis |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use qbit; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub myfunc { |
35
|
|
|
|
|
|
|
my ($a1, $a2) = @_; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
throw Exception::BadArguments gettext('First argument must be defined') |
38
|
|
|
|
|
|
|
unless defined($a1); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
return .... |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
try { |
44
|
|
|
|
|
|
|
my $data = myfunc(@ARGV); |
45
|
|
|
|
|
|
|
ldump($data); |
46
|
|
|
|
|
|
|
} catch Exception::BadArguments with { |
47
|
|
|
|
|
|
|
l shift->as_string(); |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 Internal packages |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=over |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item B> - realize base classes and functions to use exception in perl; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item B> - there're some function to simple logging; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item B> - there're some function to working with arrays; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item B> - there're some function to working with hashes; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item B> - there're some function to internationalization your's software; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item B> - there're some function to access package internals; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item B> - there're some function to working with strings; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item B> - there're some function to working with dates; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item B> - there're some function to manage files. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=back |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
package qbit; |
77
|
|
|
|
|
|
|
$qbit::VERSION = '2.3'; |
78
|
8
|
|
|
8
|
|
150770
|
use strict; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
296
|
|
79
|
8
|
|
|
8
|
|
39
|
use warnings FATAL => 'all'; |
|
8
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
422
|
|
80
|
8
|
|
|
8
|
|
5435
|
use utf8; |
|
8
|
|
|
|
|
92
|
|
|
8
|
|
|
|
|
43
|
|
81
|
8
|
|
|
8
|
|
4610
|
use open(); |
|
8
|
|
|
|
|
9868
|
|
|
8
|
|
|
|
|
195
|
|
82
|
8
|
|
|
8
|
|
47
|
use Scalar::Util (); |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
129
|
|
83
|
8
|
|
|
8
|
|
5873
|
use Data::Dumper (); |
|
8
|
|
|
|
|
75874
|
|
|
8
|
|
|
|
|
262
|
|
84
|
8
|
|
|
8
|
|
4618
|
use Clone (); |
|
8
|
|
|
|
|
23707
|
|
|
8
|
|
|
|
|
232
|
|
85
|
|
|
|
|
|
|
|
86
|
8
|
|
|
8
|
|
4236
|
use qbit::Exceptions (); |
|
8
|
|
|
|
|
20
|
|
|
8
|
|
|
|
|
201
|
|
87
|
8
|
|
|
8
|
|
3573
|
use qbit::Log (); |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
277
|
|
88
|
8
|
|
|
8
|
|
3559
|
use qbit::Array (); |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
168
|
|
89
|
8
|
|
|
8
|
|
3336
|
use qbit::Hash (); |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
163
|
|
90
|
8
|
|
|
8
|
|
3372
|
use qbit::GetText (); |
|
8
|
|
|
|
|
27
|
|
|
8
|
|
|
|
|
292
|
|
91
|
8
|
|
|
8
|
|
4167
|
use qbit::Packages (); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
use qbit::StringUtils (); |
93
|
|
|
|
|
|
|
use qbit::Date (); |
94
|
|
|
|
|
|
|
use qbit::File (); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub import { |
97
|
|
|
|
|
|
|
$^H |= $utf8::hint_bits; |
98
|
|
|
|
|
|
|
$^H |= 0x00000002 | 0x00000200 | 0x00000400; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
${^WARNING_BITS} |= $warnings::Bits{'all'}; |
101
|
|
|
|
|
|
|
${^WARNING_BITS} |= $warnings::DeadBits{'all'}; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
my $pkg = caller; |
104
|
|
|
|
|
|
|
my $pkg_sym_tbl = qbit::Packages::package_sym_table($pkg); |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
{ |
107
|
|
|
|
|
|
|
no strict 'refs'; |
108
|
|
|
|
|
|
|
*{"${pkg}::TRUE"} = sub () {1}; |
109
|
|
|
|
|
|
|
*{"${pkg}::FALSE"} = sub () {''}; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Scalar::Util->export_to_level( |
113
|
|
|
|
|
|
|
1, undef, |
114
|
|
|
|
|
|
|
@{ |
115
|
|
|
|
|
|
|
qbit::Array::arrays_difference( |
116
|
|
|
|
|
|
|
[ |
117
|
|
|
|
|
|
|
qw(set_prototype blessed dualvar isweak readonly refaddr reftype tainted weaken isvstring looks_like_number) |
118
|
|
|
|
|
|
|
], |
119
|
|
|
|
|
|
|
[keys(%$pkg_sym_tbl)] |
120
|
|
|
|
|
|
|
) |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
); # Don't export functions, if they were imported before |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Data::Dumper->export_to_level(1, qw(Dumper)); |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Clone->export_to_level(1, undef, qw(clone)); |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
qbit::Exceptions->export_to_level(1); |
129
|
|
|
|
|
|
|
qbit::Log->export_to_level(1); |
130
|
|
|
|
|
|
|
qbit::Array->export_to_level(1); |
131
|
|
|
|
|
|
|
qbit::Hash->export_to_level(1); |
132
|
|
|
|
|
|
|
qbit::Packages->export_to_level(1); |
133
|
|
|
|
|
|
|
qbit::GetText->export_to_level(1); |
134
|
|
|
|
|
|
|
qbit::StringUtils->export_to_level(1); |
135
|
|
|
|
|
|
|
qbit::Date->export_to_level(1); |
136
|
|
|
|
|
|
|
qbit::File->export_to_level(1); |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
@_ = qw(open :std :utf8); |
139
|
|
|
|
|
|
|
goto &open::import; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
1; |