MDK::Common::File man page on Mageia

Man page or keyword search:  
man Server   17783 pages
apropos Keyword Search (all sections)
Output format
Mageia logo
[printable version]

MDK::Common::File(3)  User Contributed Perl Documentation MDK::Common::File(3)

NAME
       MDK::Common::File - miscellaneous file/filename manipulation functions

SYNOPSIS
	   use MDK::Common::File qw(:all);

EXPORTS
       dirname(FILENAME)
       basename(FILENAME)
	   returns the dirname/basename of the file name

       cat_(FILES)
	   returns the files contents: in scalar context it returns a single
	   string, in array context it returns the lines.

	   If no file is found, undef is returned

       cat_or_die(FILENAME)
	   same as "cat_" but dies when something goes wrong

       cat_utf8(FILES)
	   same as C(<cat_>) but reads utf8 encoded strings

       cat_utf8_or_die(FILES)
	   same as C(<cat_or_die>) but reads utf8 encoded strings

       cat__(FILEHANDLE REF)
	   returns the file content: in scalar context it returns a single
	   string, in array context it returns the lines

       output(FILENAME, LIST)
	   creates a file and outputs the list (if the file exists, it is
	   clobbered)

       output_utf8(FILENAME, LIST)
	   same as C(<output>) but writes utf8 encoded strings

       secured_output(FILENAME, LIST)
	   likes output() but prevents insecured usage (it dies if somebody
	   try to exploit the race window between unlink() and creat())

       append_to_file(FILENAME, LIST)
	   add the LIST at the end of the file

       output_p(FILENAME, LIST)
	   just like "output" but creates directories if needed

       output_with_perm(FILENAME, PERMISSION, LIST)
	   same as "output_p" but sets FILENAME permission to PERMISSION
	   (using chmod)

       mkdir_p(DIRNAME)
	   creates the directory (make parent directories as needed)

       rm_rf(FILES)
	   remove the files (including sub-directories)

       cp_f(FILES, DEST)
	   just like "cp -f"

       cp_af(FILES, DEST)
	   just like "cp -af"

       cp_afx(FILES, DEST)
	   just like "cp -afx"

       linkf(SOURCE, DESTINATION)
       symlinkf(SOURCE, DESTINATION)
       renamef(SOURCE, DESTINATION)
	   same as link/symlink/rename but removes the destination file first

       touch(FILENAME)
	   ensure the file exists, set the modification time to current time

       all(DIRNAME)
	   returns all the file in directory (except "." and "..")

       all_files_rec(DIRNAME)
	   returns all the files in directory and the sub-directories (except
	   "." and "..")

       glob_(STRING)
	   simple version of "glob": doesn't handle wildcards in directory
	   (eg: */foo.c), nor special constructs (eg: [0-9] or {a,b})

       substInFile { CODE } FILENAME
	   executes the code for each line of the file. You can know the end
	   of the file is reached using "eof"

       expand_symlinks(FILENAME)
	   expand the symlinks in the absolute filename:
	   "expand_symlinks("/etc/X11/X")" gives "/usr/X11R6/bin/XFree86"

       openFileMaybeCompressed(FILENAME)
	   opens the file and returns the file handle. If the file is not
	   found, tries to gunzip the file + .gz

       catMaybeCompressed(FILENAME)
	   cat_ alike. If the file is not found, tries to gunzip the file +
	   .gz

SEE ALSO
       MDK::Common

perl v5.18.1			  2011-09-14		  MDK::Common::File(3)
[top]

List of man pages available for Mageia

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net