Acme-CPANModules-MagicVariableTechnique
view release on metacpan or search on metacpan
":PerlExecFiles"
],
"skips" : [],
"switch" : []
}
},
"name" : "@Author::PERLANCAR/Test::Compile",
"version" : "2.058"
},
{
"class" : "Dist::Zilla::Plugin::Test::Perl::Critic::Subset",
"config" : {
"Dist::Zilla::Plugin::Test::Perl::Critic::Subset" : {
"finder" : [
":ExecFiles",
":InstallModules",
":TestFiles"
]
}
},
"name" : "@Author::PERLANCAR/Test::Perl::Critic::Subset",
"version" : "3.001.006"
},
{
"class" : "Dist::Zilla::Plugin::Test::Rinci",
"name" : "@Author::PERLANCAR/Test::Rinci",
"version" : "0.040"
},
{
"class" : "Dist::Zilla::Plugin::StaticInstall",
"config" : {
- ':InstallModules'
needs_display: 0
phase: test
script_finder:
- ':PerlExecFiles'
skips: []
switch: []
name: '@Author::PERLANCAR/Test::Compile'
version: '2.058'
-
class: Dist::Zilla::Plugin::Test::Perl::Critic::Subset
config:
Dist::Zilla::Plugin::Test::Perl::Critic::Subset:
finder:
- ':ExecFiles'
- ':InstallModules'
- ':TestFiles'
name: '@Author::PERLANCAR/Test::Perl::Critic::Subset'
version: 3.001.006
-
class: Dist::Zilla::Plugin::Test::Rinci
name: '@Author::PERLANCAR/Test::Rinci'
version: '0.040'
-
class: Dist::Zilla::Plugin::StaticInstall
config:
Dist::Zilla::Plugin::StaticInstall:
dry_run: 0
Acme::CPANModules::MagicVariableTechnique - List of modules which employ
magic variable technique to do stuffs
VERSION
This document describes version 0.002 of
Acme::CPANModules::MagicVariableTechnique (from Perl distribution
Acme-CPANModules-MagicVariableTechnique), released on 2023-10-29.
DESCRIPTION
This is a list of modules which provide some "magic" variable which you
can get/set to perform stuffs. I personally find this technique is
mostly useful to "temporarily set" stuffs, by combining it with Perl's
local().
ACME::CPANMODULES ENTRIES
File::chdir
Author: DAGOLDEN <https://metacpan.org/author/DAGOLDEN>
Provides $CWD which you can use to change directory. By doing:
local $CWD = ...;
temporarily without messing current directory and breaking code in
other parts. Very handy and convenient.
This is the first module I found/use where I realized the technique.
Since then I've been looking for other modules using similar
technique, and have even created a few myself.
File::umask
Author: SHARYANTO <https://metacpan.org/author/SHARYANTO>
Provides $UMASK to get/set umask.
Umask::Local
Author: ROUZIER <https://metacpan.org/author/ROUZIER>
Like File::umask, but instead of using a tied variable, uses an
object with its "DESTROY" method restoring original umask. I find
the interface a bit more awkward.
Alternate modules: File::umask
Locale::Tie
Author: PERLANCAR <https://metacpan.org/author/PERLANCAR>
Provides $LANG, $LC_ALL, $LC_TIME, and few others to let you
(temporarily) set locale settings.
Locale::Scope
Author: KARUPA <https://metacpan.org/author/KARUPA>
Like Locale::Tie, but instead of using a tied variable, uses an
object with its "DESTROY" method restoring original settings.
FAQ
What is an Acme::CPANModules::* module?
An Acme::CPANModules::* module, like this module, contains just a list
of module names that share a common characteristics. It is a way to
categorize modules and document CPAN. See Acme::CPANModules for more
details.
What are ways to use this Acme::CPANModules module?
Aside from reading this Acme::CPANModules module's POD documentation,
lib/Acme/CPANModules/MagicVariableTechnique.pm view on Meta::CPAN
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2023-10-29'; # DATE
our $DIST = 'Acme-CPANModules-MagicVariableTechnique'; # DIST
our $VERSION = '0.002'; # VERSION
our $LIST = {
summary => 'List of modules which employ magic variable technique to do stuffs',
description => <<'_',
This is a list of modules which provide some "magic" variable which you can
get/set to perform stuffs. I personally find this technique is mostly useful to
"temporarily set" stuffs, by combining it with Perl's `local()`.
_
entries => [
{
module => 'File::chdir',
description => <<'_',
Provides `$CWD` which you can use to change directory. By doing:
local $CWD = ...;
lib/Acme/CPANModules/MagicVariableTechnique.pm view on Meta::CPAN
This is the first module I found/use where I realized the technique. Since then
I've been looking for other modules using similar technique, and have even
created a few myself.
_
},
{
module => 'File::umask',
description => <<'_',
Provides `$UMASK` to get/set umask.
_
},
{
module => 'Umask::Local',
description => <<'_',
Like <pm:File::umask>, but instead of using a tied variable, uses an object with
its `DESTROY` method restoring original umask. I find the interface a bit more
awkward.
_
alternate_modules => ['File::umask'],
},
{
module => 'Locale::Tie',
description => <<'_',
Provides `$LANG`, `$LC_ALL`, `$LC_TIME`, and few others to let you (temporarily)
set locale settings.
_
},
{
module => 'Locale::Scope',
description => <<'_',
Like <pm:Locale::Tie>, but instead of using a tied variable, uses an object with
its `DESTROY` method restoring original settings.
_
},
],
};
1;
# ABSTRACT: List of modules which employ magic variable technique to do stuffs
__END__
lib/Acme/CPANModules/MagicVariableTechnique.pm view on Meta::CPAN
Acme::CPANModules::MagicVariableTechnique - List of modules which employ magic variable technique to do stuffs
=head1 VERSION
This document describes version 0.002 of Acme::CPANModules::MagicVariableTechnique (from Perl distribution Acme-CPANModules-MagicVariableTechnique), released on 2023-10-29.
=head1 DESCRIPTION
This is a list of modules which provide some "magic" variable which you can
get/set to perform stuffs. I personally find this technique is mostly useful to
"temporarily set" stuffs, by combining it with Perl's C<local()>.
=head1 ACME::CPANMODULES ENTRIES
=over
=item L<File::chdir>
Author: L<DAGOLDEN|https://metacpan.org/author/DAGOLDEN>
Provides C<$CWD> which you can use to change directory. By doing:
lib/Acme/CPANModules/MagicVariableTechnique.pm view on Meta::CPAN
This is the first module I found/use where I realized the technique. Since then
I've been looking for other modules using similar technique, and have even
created a few myself.
=item L<File::umask>
Author: L<SHARYANTO|https://metacpan.org/author/SHARYANTO>
Provides C<$UMASK> to get/set umask.
=item L<Umask::Local>
Author: L<ROUZIER|https://metacpan.org/author/ROUZIER>
Like L<File::umask>, but instead of using a tied variable, uses an object with
its C<DESTROY> method restoring original umask. I find the interface a bit more
awkward.
Alternate modules: L<File::umask>
=item L<Locale::Tie>
Author: L<PERLANCAR|https://metacpan.org/author/PERLANCAR>
Provides C<$LANG>, C<$LC_ALL>, C<$LC_TIME>, and few others to let you (temporarily)
set locale settings.
=item L<Locale::Scope>
Author: L<KARUPA|https://metacpan.org/author/KARUPA>
Like L<Locale::Tie>, but instead of using a tied variable, uses an object with
its C<DESTROY> method restoring original settings.
=back
=head1 FAQ
=head2 What is an Acme::CPANModules::* module?
An Acme::CPANModules::* module, like this module, contains just a list of module
names that share a common characteristics. It is a way to categorize modules and
t/author-critic.t view on Meta::CPAN
unless ($ENV{AUTHOR_TESTING}) {
print qq{1..0 # SKIP these tests are for testing by the author\n};
exit
}
}
use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::Perl::Critic::Subset 3.001.006
use Test::Perl::Critic (-profile => "") x!! -e "";
my $filenames = ['lib/Acme/CPANModules/MagicVariableTechnique.pm'];
unless ($filenames && @$filenames) {
$filenames = -d "blib" ? ["blib"] : ["lib"];
}
all_critic_ok(@$filenames);
( run in 0.604 second using v1.01-cache-2.11-cpan-49f99fa48dc )