1NAME 2 File::Stat::ModeString - conversion file stat(2) mode to/from string 3 representation. 4 5SYNOPSIS 6 use File::Stat::ModeString; 7 8 $string = mode_to_string ( $st_mode ); 9 $st_mode = string_to_mode ( $string ); 10 $type = mode_to_typechar( $st_mode ); 11 12 $record = <IN>; chomp $record; 13 $record =~ m/^some_prefix\s+$MODE_STRING_RE\s+some_suffix$/o 14 or die "invalid record format"; 15 16 die "Invalid mode in $string" 17 if is_mode_string_valid( $string ); 18 19DESCRIPTION 20 This module provides a few functions for conversion between binary and 21 literal representations of file mode bits, including file type. 22 23 All of them use only symbolic constants for mode bits from 24 File::Stat::Bits. 25 26CONSTANTS 27 $MODE_STRING_RE 28 Regular expression to match mode string (without ^$). 29 30FUNCTIONS 31 32 is_mode_string_valid( $string ) 33 34 Returns true if argument matches mode string pattern. 35 36 37 $type = mode_to_typechar( $mode ) 38 39 Returns file type character of binary mode, '?' on unknown file type. 40 41 42 $string = mode_to_string( $mode ) 43 44 Converts binary mode value to string representation. '?' in file type 45 field on unknown file type. 46 47 48 $mode = string_to_mode( $string ) 49 50 Converts string representation of file mode to binary one. 51 52SEE ALSO 53 stat(2); 54 55 File::Stat::Bits(3); 56 57 Stat::lsMode(3); 58 59AUTHOR 60 Dmitry Fedorov <dm.fedorov@gmail.com> 61 62COPYRIGHT 63 Copyright (C) 2003 Dmitry Fedorov <dm.fedorov@gmail.com> 64 65LICENSE 66 This program is free software; you can redistribute it and/or modify it 67 under the terms of the GNU General Public License as published by the 68 Free Software Foundation; either version 2 of the License, or (at your 69 option) any later version. 70 71DISCLAIMER 72 The author disclaims any responsibility for any mangling of your system 73 etc, that this script may cause. 74 75