~ubuntu-branches/ubuntu/utopic/libfile-chmod-perl/utopic

« back to all changes in this revision

Viewing changes to lib/File/chmod.pm

  • Committer: Package Import Robot
  • Author(s): gregor herrmann
  • Date: 2013-12-27 21:43:17 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20131227214317-56ntbqakib5po1nk
Tags: 0.40-1
* New upstream release.
* Install new CONTRIBUTING file.
* Declare compliance with Debian Policy 3.9.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
use base 'Exporter';
8
8
 
9
 
our $VERSION = '0.39'; # VERSION
 
9
our $VERSION = '0.40'; # VERSION
10
10
 
11
11
our @EXPORT    = (qw( chmod getchmod )); ## no critic ( ProhibitAutomaticExportation )
12
12
our @EXPORT_OK = (qw( symchmod lschmod getsymchmod getlschmod getmod ));
36
36
}
37
37
 
38
38
 
39
 
sub chmod { ## no critic ( Subroutines::ProhibitBuiltinHomonyms )
 
39
sub chmod (@) { ## no critic ( Subroutines::ProhibitBuiltinHomonyms Subroutines::ProhibitSubroutinePrototypes )
40
40
  my $mode = shift;
41
41
  my $how = mode($mode);
42
42
 
59
59
sub symchmod {
60
60
  my $mode = shift;
61
61
 
62
 
#  warnings::warnif 'deprecated', '$UMASK being true is deprecated'
63
 
#    . ' it will be false by default in the future. This change'
64
 
#    . ' is being made because this not the behavior of the unix command'
65
 
#    . ' `chmod`. This warning can be disabled by putting explicitly'
66
 
#    . ' setting $File::chmod::UMASK to false or any non 2 true value'
67
 
#    if $UMASK == 2;
68
 
 
69
62
  my @return = getsymchmod($mode,@_);
70
63
  my $ret = 0;
71
64
  for (@_){ $ret++ if CORE::chmod(shift(@return),$_) }
328
321
 
329
322
=head1 VERSION
330
323
 
331
 
version 0.39
 
324
version 0.40
332
325
 
333
326
=head1 SYNOPSIS
334
327
 
335
328
  use File::chmod;
336
 
  # It is recommended that you explicitly set $UMASK as the default may change
337
 
  # in the future, 0 is recommended to behave like system chmod, set to 1 if
338
 
  # you want it enabled, so that if later we decide to disable it by default
339
 
  # it won't change your code. $UMASK has been changed to be true by using
340
 
  # numeric value 2 internally
341
 
  $File::chmod::UMASK = 0;
 
329
  $File::chmod::UMASK = 0; # you may want this, it ignores the systems umask setting
342
330
 
343
331
  # chmod takes all three types
344
332
  # these all do the same thing
368
356
An added feature to version 0.30 is the C<$UMASK> variable, explained in
369
357
detail below; if C<symchmod()> is called and this variable is true, then the
370
358
function uses the (also new) C<$MASK> variable (which defaults to C<umask()>)
371
 
as a mask against the new mode. This mode is one by default, and changes the
 
359
as a mask against the new mode. This mode is on by default, and changes the
372
360
behavior from what you would expect if you are used to UNIX C<chmod>.
373
 
B<This may change in the future.>
374
361
 
375
362
Symbolic modes are thoroughly described in your chmod(1) man page, but
376
363
here are a few examples.
546
533
 
547
534
=item *
548
535
 
 
536
Steve Throckmorton <arrestee@gmail.com>
 
537
 
 
538
=item *
 
539
 
549
540
Tim <oylenshpeegul@gmail.com>
550
541
 
551
542
=back