package File::umask;

use 5.010001;
use strict;
use warnings;

use POSIX qw();

use Exporter qw(import);
our @EXPORT = qw($UMASK);

our $VERSION = '0.01'; # VERSION
our $DATE = '2014-05-14'; # DATE

our $UMASK; tie $UMASK, 'File::umask::SCALAR' or die "Can't tie \$UMASK";

    package File::umask::SCALAR;

    sub TIESCALAR {
        bless [], $_[0];

    sub FETCH {

    sub STORE {

#ABSTRACT: Get/set umask via (localizeable) variable



=encoding UTF-8

=head1 NAME

File::umask - Get/set umask via (localizeable) variable

=head1 VERSION

This document describes version 0.01 of File::umask (from Perl distribution File-umask), released on 2014-05-14.


 use File::umask;
 printf "Current umask is %03o", $UMASK; # -> 022
     local $UMASK = 0;
     open my($fh), ">", "/tmp/foo"; # file created with 666 permission mode
 open my($fh), ">", "/tmp/two"; # file created with normal 644 permission mode


This module is inspired by L<File::chdir>, using a tied scalar variable to
get/set stuffs. One benefit of this is being able to use Perl's "local" with it,
effectively setting something locally.

=head1 EXPORTS

=head2 $UMASK (exported by default)

=head1 SEE ALSO

Perl's umask builtin.


Other modules with the same concept: L<File::chdir>, L<Locale::Tie>.


Please visit the project's homepage at L<>.

=head1 SOURCE

Source repository is at L<>.

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website L<>

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

=head1 AUTHOR

Steven Haryanto <>


This software is copyright (c) 2014 by Steven Haryanto.

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