blib/lib/Acme/CPANModules/MagicVariableTechnique.pm

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