| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Acme::CPANModules::MagicVariableTechnique; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
365095
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
192
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
|
6
|
|
|
|
|
|
|
our $DATE = '2023-10-29'; # DATE |
|
7
|
|
|
|
|
|
|
our $DIST = 'Acme-CPANModules-MagicVariableTechnique'; # DIST |
|
8
|
|
|
|
|
|
|
our $VERSION = '0.002'; # VERSION |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $LIST = { |
|
11
|
|
|
|
|
|
|
summary => 'List of modules which employ magic variable technique to do stuffs', |
|
12
|
|
|
|
|
|
|
description => <<'_', |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
This is a list of modules which provide some "magic" variable which you can |
|
15
|
|
|
|
|
|
|
get/set to perform stuffs. I personally find this technique is mostly useful to |
|
16
|
|
|
|
|
|
|
"temporarily set" stuffs, by combining it with Perl's `local()`. |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
_ |
|
19
|
|
|
|
|
|
|
entries => [ |
|
20
|
|
|
|
|
|
|
{ |
|
21
|
|
|
|
|
|
|
module => 'File::chdir', |
|
22
|
|
|
|
|
|
|
description => <<'_', |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Provides `$CWD` which you can use to change directory. By doing: |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
local $CWD = ...; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
in a subroutine or block, you can safely change directory temporarily without |
|
29
|
|
|
|
|
|
|
messing current directory and breaking code in other parts. Very handy and |
|
30
|
|
|
|
|
|
|
convenient. |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
This is the first module I found/use where I realized the technique. Since then |
|
33
|
|
|
|
|
|
|
I've been looking for other modules using similar technique, and have even |
|
34
|
|
|
|
|
|
|
created a few myself. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
_ |
|
37
|
|
|
|
|
|
|
}, |
|
38
|
|
|
|
|
|
|
{ |
|
39
|
|
|
|
|
|
|
module => 'File::umask', |
|
40
|
|
|
|
|
|
|
description => <<'_', |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Provides `$UMASK` to get/set umask. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
_ |
|
45
|
|
|
|
|
|
|
}, |
|
46
|
|
|
|
|
|
|
{ |
|
47
|
|
|
|
|
|
|
module => 'Umask::Local', |
|
48
|
|
|
|
|
|
|
description => <<'_', |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Like , but instead of using a tied variable, uses an object with |
|
51
|
|
|
|
|
|
|
its `DESTROY` method restoring original umask. I find the interface a bit more |
|
52
|
|
|
|
|
|
|
awkward. |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
_ |
|
55
|
|
|
|
|
|
|
alternate_modules => ['File::umask'], |
|
56
|
|
|
|
|
|
|
}, |
|
57
|
|
|
|
|
|
|
{ |
|
58
|
|
|
|
|
|
|
module => 'Locale::Tie', |
|
59
|
|
|
|
|
|
|
description => <<'_', |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Provides `$LANG`, `$LC_ALL`, `$LC_TIME`, and few others to let you (temporarily) |
|
62
|
|
|
|
|
|
|
set locale settings. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
_ |
|
65
|
|
|
|
|
|
|
}, |
|
66
|
|
|
|
|
|
|
{ |
|
67
|
|
|
|
|
|
|
module => 'Locale::Scope', |
|
68
|
|
|
|
|
|
|
description => <<'_', |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Like , but instead of using a tied variable, uses an object with |
|
71
|
|
|
|
|
|
|
its `DESTROY` method restoring original settings. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
_ |
|
74
|
|
|
|
|
|
|
}, |
|
75
|
|
|
|
|
|
|
], |
|
76
|
|
|
|
|
|
|
}; |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
|
79
|
|
|
|
|
|
|
# ABSTRACT: List of modules which employ magic variable technique to do stuffs |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |