Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 976 Categories, Downloaded 29.643.186 Times

Stat::lsMode 0.50

  Date Added: May 12, 2010  |  Visits: 1.257

Stat::lsMode

Report Broken Link
Printer Friendly Version


Product Homepage
Download (80 downloads)



Stat::lsMode Perl module can format file modes like the ls -l command does. SYNOPSIS use Stat::lsMode; $mode = (stat $file)[2]; $permissions = format_mode($mode); # $permissions is now something like `drwxr-xr-x $permissions = file_mode($file); # Same as above $permissions = format_perms(0644); # Produces just rw-r--r-- $permissions = format_perms(644); # This generates a warning message: # mode 644 is very surprising. Perhaps you meant 0644... Stat::lsMode->novice(0); # Disable warning messages Stat::lsMode generates mode and permission strings that look like the ones generated by the Unix ls -l command. For example, a regular file that is readable by everyone and writable only by its owner has the mode string -rw-r--r--. Stat::lsMode will either examine the file and produce the right mode string for you, or you can pass it the mode that you get back from Perls stat call. format_mode Given a mode number (such as the third element of the list returned by stat), return the appopriate ten-character mode string as it would have been generated by ls -l. For example, consider a directory that is readable and searchable by everyone, and also writable by its owner. Such a directory will have mode 040755. When passed this value, format_mode will return the string drwxr-xr-x. If format_mode is passed a permission number like 0755, it will return a nine-character string insted, with no leading character to say what the file type is. For example, format_mode(0755) will return just rwxr-xr-x, without the leading d. file_mode Given a filename, do lstat on the file to determine the mode, and return the mode, formatted as above. Novice Operation Mode A common mistake when dealing with permission modes is to use 644 where you meant to use 0644. Every permission has a numeric representation, but the representation only makes sense when you write the number in octal. The decimal number 644 corresponds to a permission setting, but not the one you think. If you write it in octal you get 01204, which corresponds to the unlikely permissions -w----r-T, not to rw-r--r--. The appearance of the bizarre permission -w----r-T in a program is almost a sure sign that someone used 644 when they meant to use 0644. By default, this module will detect the use of such unlikely permissions and issue a warning if you try to format them. To disable these warnings, use Stat::lsMode->novice(0); # disable novice mode Stat::lsMode->novice(1); # enable novice mode again The surprising permissions that are diagnosed by this mode are: 111 => --xr-xrwx 400 => rw--w---- 440 => rw-rwx--- 444 => rw-rwxr-- 551 => ---r--rwt 600 => --x-wx--T 640 => -w------T 644 => -w----r-T 660 => -w--w-r-T 664 => -w--wx--T 666 => -w--wx-wT 700 => -w-rwxr-T 711 => -wx---rwt 750 => -wxr-xrwT 751 => -wxr-xrwt 751 => -wxr-xrwt 755 => -wxrw--wt 770 => r------wT 771 => r------wt 775 => r-----rwt 777 => r----x--t Of these, only 400 is remotely plausible. BUGS As far as I know, the precise definition of the mode bits is portable between varieties of Unix. The module should, however, examine stat.h or use some other method to find out if there are any local variations, because Unix being Unix, someone somewhere probably does it differently. Maybe it file_mode should have an option that says that if the file is a symlink, to format the mode of the pointed to file instead of the mode of the link itself, the way ls -Ll does..

Requirements: No special requirements
Platforms: Linux
Keyword: -l File File Modes Format Format File Libraries Ls Mode Perl Module Permissions Programming Statlsmode
Users rating: 0/10

License: Freeware Size: 4.1 KB
USER REVIEWS
More Reviews or Write Review


STAT::LSMODE RELATED
Libraries  -  File::Format::RIFF 1.0.1
File::Format::RIFF is a Perl module to Resource Interchange File Format/RIFF files. SYNOPSIS use File::Format::RIFF; open( IN, file ) or die "Could not open file: $!"; my ( $riff1 ) = File::Format::RIFF->read( *IN ); close( IN );...
9.22 KB  
Libraries  -  File::chmod 0.31
File::chmod is a Perl module that implements symbolic and ls chmod modes. SYNOPSIS use File::chmod; # chmod takes all three types # these all do the same thing chmod(0666,@files); chmod("=rw",@files); chmod("-rw-rw-rw-",@files); # or...
8.19 KB  
Libraries  -  File::Comments 0.07
File::Comments is a Perl module that ecognizes file formats and extracts format-specific comments. SYNOPSIS use File::Comments; my $snoop = File::Comments->new(); # *---------------- # | program.c: # | /* comment */ # | main () {} #...
12.29 KB  
Libraries  -  File::Listing 5.805
File::Listing is a Perl module to parse directory listing. SYNOPSIS use File::Listing qw(parse_dir); for (parse_dir(`ls -l`)) { ($name, $type, $size, $mtime, $mode) = @$_; next if $type ne f; # plain file #... } # directory listing can...
235.52 KB  
Libraries  -  Spreadsheet::WriteExcelXML 0.10
Spreadsheet::WriteExcelXML is a Perl module that can create an Excel file in XML format. SYNOPSIS To write a string, a formatted string, a number and a formula to the first worksheet in an Excel XML spreadsheet called perl.xls: use...
143.36 KB  
Libraries  -  Audio::File::AudioProperties 0.10
Audio::File::AudioProperties is a Perl module that can abstract an audio files audio properties. Audio::File::AudioProperties is the base class for other file format independant audio property classes like Audio::File::Flac::AudioProperties or...
74.75 KB  
Libraries  -  File::FilterFuncs 0.53
File::FilterFuncs is a Perl module that specify filter functions for files. SYNOPSIS use File::FilterFuncs qw(filters); filters(source.txt, sub { $_ = uc $_; 1 }, dest.txt ); INTRODUCTION File::FilterFuncs makes it easy to perform...
12.29 KB  
Libraries  -  File::Type::Builder 0.22
File::Type::Builder is Perl module to parse mime-magic and generate code. SYNOPSIS my $build = File::Type::Builder->new(); while ( ) { chomp; my $parsed = $build->parse_magic($_); my $code = $build->string_start($parsed); (or...
153.6 KB  
Libraries  -  Nokia::File::NFB 0.01
Nokia::File::NFB is a Perl module to create, read and write Nokia nfb/nfc phone backup files. SYNOPSIS use Nokia::File::NFB; my $nfb = new Nokia::File::NFB; ## read in the file phone_backup.nfb. $nfb->read(phone_backup.nfb); ## print...
7.17 KB  
Libraries  -  File::Maker 0.05
File::Maker is a Perl module that mimics a make by loading a database and calling targets methods. SYNOPSIS ##### # Subroutine interface # use File::Maker qw(load_db); %data = load_db($pm); ###### # Object interface # require...
77.82 KB  
NEW DOWNLOADS IN PROGRAMMING, LIBRARIES
Programming  -  FLEX-db Digital Asset Manager 3.0.9
FLEX-db - an enterprise Digital Asset Manager (DAM). It ingests and links metadata with files, creates thumbnails, and processes files using business rules. FLEX-db has a JSP client, Java app server for file input and output and an EJB metadata...
21.57 MB  
Programming  -  Libicom 0.9.0
The libicom library is a character based dynamicly linked library for Linux. It is used to remotely control the Icom IC-R8500 wide band receiver via an RS232 link. All call and return parameters to the control functions are character string based....
20.48 KB  
Programming  -  dotdesktop 0.3
Dotdesktop library provides ability to parse desktop entry file and access the information in a convenient way. Desktop entry file format is defined by freedesktop.org, it is used to describe information about an application such as the name and...
327.68 KB  
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  libyasl 0.2
Libyasl is a C++ class library to easily realize TCP/UDP/Multicast clientsand servers in IPv4 and IPv6 environments under GNU/Linux systems.
143.36 KB  
Libraries  -  wolfSSL 3.11.0
The wolfSSL embedded SSL/TLS library is a lightweight SSL library written in ANSI standard C and targeted for embedded and RTOS environments - primarily because of its small size, speed, and feature set. It is commonly used in standard operating...
2.73 MB  
Libraries  -  EuGTK 4.8.9
Makes it easy to develop good- looking, fast, cross-platform programs that run on Linux, OS X, and Windows. Euphoria is a very fast interpreted/compiled language with straight-forward syntax. EuGTK allows programming in a clean, object-oriented...
10.68 MB  
Libraries  -  Linux User Group Library Manager 1.0
The LUG Library Manager is a project to help Linux User Groups start their own library. A LUG library is helpful to the community at large because it increases access to information, and gives everyone the opportunity to become more knowledgeable.
5.35 KB  
Libraries  -  Module::MakefilePL::Parse 0.12
Module::MakefilePL::Parse is a Perl module to parse required modules from Makefile.PL. SYNOPSIS use Module::MakefilePL::Parse; open $fh, Makefile.PL; $parser = Module::MakefilePL::Parse->new( join("", ) ); $info = $parser->required;...
8.19 KB  
Libraries  -  sqlpp 0.06
sqlpp Perl package is a SQL preprocessor. sqlpp is a conventional cpp-alike preprocessor taught to understand SQL ( PgSQL, in particular) syntax specificities. In addition to the standard #define/#ifdef/#else/#endif cohort, provides also...
10.24 KB