Acme-CPANLists-PERLANCAR

 view release on metacpan or  search on metacpan

lib/Acme/CPANLists/PERLANCAR/MagicVariableTechnique.pm  view on Meta::CPAN

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()>.


=over

=item * L<File::chdir>

Provides C<$CWD> which you can use to change directory. By doing:

 local $CWD = ...;

in a subroutine or block, you can safely change directory 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.


=item * L<File::umask>

Provides C<$UMASK> to get/set umask.


=item * L<Umask::Local>

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>

Provides C<$LANG>, C<$LC_ALL>, C<$LC_TIME>, and few others to let you (temporarily)
set locale settings.


=item * L<Locale::Scope>

Like L<Locale::Tie>, but instead of using a tied variable, uses an object with
its C<DESTROY> method restoring original settings.


=back

=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/Acme-CPANLists-PERLANCAR>.

=head1 SOURCE

Source repository is at L<https://github.com/perlancar/perl-Acme-CPANLists-PERLANCAR>.

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Acme-CPANLists-PERLANCAR>

When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.

=head1 SEE ALSO

L<Acme::CPANLists> - about the Acme::CPANLists namespace

L<acme-cpanlists> - CLI tool to let you browse/view the lists

=head1 AUTHOR

perlancar <perlancar@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2017, 2016, 2015 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut



( run in 2.976 seconds using v1.01-cache-2.11-cpan-59e3e3084b8 )