Rechercher une page de manuel
MDK::Common::File.3pm
Langue: en
Version: 2007-08-06 (mandriva - 22/10/07)
Section: 3 (Bibliothèques de fonctions)
NAME
MDK::Common::File - miscellaneous file/filename manipulation functionsSYNOPSIS
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''
- 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::CommonContenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre