Help for this page

Select Code to Download


  1. or download this
    sub perm2mode {
        my( $perm )= @_;
        if(  9 != length($perm)
    ...
        }
        return unpack "v", pack "b*", ''.reverse$perm;
    }
    
  2. or download this
    my $mode= perm2mode("rw-r----x");
    my $str= sprintf "0%o", $mode;
    print "mode=$mode str=$str\n";
    my $bad= 0+$str;
    printf "bad=%d=0%o mode=%d=0%o\n", $bad, $bad, $mode, $mode;
    
  3. or download this
    mode=417 str=0641
    bad=641=01201 mode=417=0641