File::Stat::ModeString 1.00 review

Download
by rbytes.net on

File::Stat::ModeString - conversion file stat mode to/from string representation. SYNOPSIS use File::Stat::ModeString; $st

License: Perl Artistic License
File size: 6K
Developer: Dmitry Fedorov
0 stars award from rbytes.net

File::Stat::ModeString - conversion file stat mode to/from string representation.

SYNOPSIS

use File::Stat::ModeString;

$string = mode_to_string ( $st_mode );
$st_mode = string_to_mode ( $string );
$type = mode_to_typechar( $st_mode );

$record = < IN >; chomp $record;
$record =~ m/^some_prefixs+$MODE_STRING_REs+some_suffix$/o
or die "invalid record format";

die "Invalid mode in $string"
if is_mode_string_valid( $string );

This module provides a few functions for conversion between binary and literal representations of file mode bits, including file type.

All of them use only symbolic constants for mode bits from File::Stat::Bits.

CONSTANTS

$MODE_STRING_RE

Regular expression to match mode string (without ^$).

FUNCTIONS

is_mode_string_valid( $string )

Returns true if argument matches mode string pattern.

$type = mode_to_typechar( $mode )

Returns file type character of binary mode, '?' on unknown file type.

$string = mode_to_string( $mode )

Converts binary mode value to string representation. '?' in file type field on unknown file type.

$mode = string_to_mode( $string )

Converts string representation of file mode to binary one.

Requirements:
Perl

File::Stat::ModeString 1.00 search tags