line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package oo_sub v1.1.0; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
369
|
use strict; # https://perldoc.perl.org/strict |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; # https://perldoc.perl.org/warnings |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
451
|
use Module::Load; # https://perldoc.perl.org/Module::Load |
|
1
|
|
|
|
|
936
|
|
|
1
|
|
|
|
|
4
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
463
|
use User::pwent; # https://perldoc.perl.org/User::pwent |
|
1
|
|
|
|
|
5231
|
|
|
1
|
|
|
|
|
5
|
|
9
|
1
|
|
|
1
|
|
415
|
use User::grent; # https://perldoc.perl.org/User::grent |
|
1
|
|
|
|
|
1215
|
|
|
1
|
|
|
|
|
4
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
452
|
use File::stat; # https://perldoc.perl.org/File::stat |
|
1
|
|
|
|
|
5347
|
|
|
1
|
|
|
|
|
5
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
493
|
use Time::Piece; # https://perldoc.perl.org/Time::Piece |
|
1
|
|
|
|
|
8322
|
|
|
1
|
|
|
|
|
4
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
487
|
use Net::netent; # https://perldoc.perl.org/Net::netent |
|
1
|
|
|
|
|
1294
|
|
|
1
|
|
|
|
|
3
|
|
16
|
1
|
|
|
1
|
|
420
|
use Net::protoent; # https://perldoc.perl.org/Net::protoent |
|
1
|
|
|
|
|
1126
|
|
|
1
|
|
|
|
|
8
|
|
17
|
1
|
|
|
1
|
|
422
|
use Net::servent; # https://perldoc.perl.org/Net::servent |
|
1
|
|
|
|
|
2424
|
|
|
1
|
|
|
|
|
3
|
|
18
|
1
|
|
|
1
|
|
417
|
use Net::hostent; # https://perldoc.perl.org/Net::hostent |
|
1
|
|
|
|
|
1426
|
|
|
1
|
|
|
|
|
4
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my @modules = qw( |
21
|
|
|
|
|
|
|
User::pwent |
22
|
|
|
|
|
|
|
User::grent |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
File::stat |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Time::Piece |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Net::netent |
29
|
|
|
|
|
|
|
Net::protoent |
30
|
|
|
|
|
|
|
Net::servent |
31
|
|
|
|
|
|
|
Net::hostent |
32
|
|
|
|
|
|
|
); # TODO: Don't repeat: find a way to to detect use-d modules somehow |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
for my $module ( @modules ) { |
35
|
|
|
|
|
|
|
Module::Load::autoload_remote caller, $module; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# TODO: Import modules by export categories (eg. user, time, network, file) |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# TODO: (?): Time::gmtime Time::localtime |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# https://perldoc.perl.org/Module::Load#autoload_remote |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=pod |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 NAME |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
oo_sub - Use object-oriented versions of Perl built-in functions |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 SYNOPSIS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
use oo_sub; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $user = getpwnam 'root'; |
57
|
|
|
|
|
|
|
print $user -> uid; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
my $group = getgrgid 0; |
60
|
|
|
|
|
|
|
say $group -> name; # use feature 'say'; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
say my $file = |
63
|
|
|
|
|
|
|
stat ('.') -> ino; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
printf "%s: %s", |
66
|
|
|
|
|
|
|
getprotobyname ('tcp') -> proto, |
67
|
|
|
|
|
|
|
getservbyname ('ftp') -> port; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
say Dumper getnetbyname 'loopback'; # use Data::Dumper; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
p my $time = localtime; # use DDP; (ie. Data::Printer) |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 DESCRIPTION |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Perl pragma to import the following modules to enable OOP in Perl for some built-in functions: |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=over 2 |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item L |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item L |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item L |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item L |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item L |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item L |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item L |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item L |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=back |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Uses L|Module::Load/autoload_remote> to achieve this. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 AUTHOR |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
L L<(rwp.primary@gmail.com)|mailto:rwp.primary@gmail.com> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 COPYRIGHT |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This library is free software; you may redistribute and/or modify it |
108
|
|
|
|
|
|
|
under the same terms as Perl itself. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 SEE ALSO |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
L, L, L, L |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |