Term::Clui::FileSelect.pm - Perl module to ask the user to select a file.
use Term::Clui::FileSelect; $file = &select_file(-Readable=>1, -TopDir=>'/home/www', -FPat='*.html');
This module asks the user to select a file from the filesystem. It uses the Command-line user-interface Term::Clui to dialogue with the user. It offers Rescan and ShowAll buttons. To ease the re-learning burden for the programmer, the options are modelled on those of Tk::FileDialog and of Tk::SimpleFileSelect, but various new options are introduced, namely -TopDir, -TextFile, -Readable, -Writeable, -Executable and -Owned.
Enable the user to change directories. The default is 1.
Enable the user to specify a file that does not exist. The default is 0.
Determines whether hidden files (.*) are displayed. The default is 0.
Disables the ability of the user to change the status of the ShowAll flag. The default is 0 (i.e. the user is by default allowed to change the status).
If True, enables selection of a directory rather than a file. The default is 0. There is currently no way to enforce selection of a directory . . .
Sets the default file selection pattern, in 'glob' format, e.g. *.html. Only files matching this pattern will be displayed. The default is '*'.
The file selected, or the default file. The default default is whatever the user selected last time in this directory.
The path of the selected file, or the initial path. The default is $ENV{'HOME'}.
The Title of the dialog box. The default is 'in directory /where/ever'.
Restricts the user to remain within a directory or its subdirectories. The default is "/". This option, and the following, are not offered by Tk::FileDialog.
Only text files will be displayed. The default is 0.
Only readable files will be displayed. The default is 0.
Only writeable files will be displayed. The default is 0.
Only executable files will be displayed. The default is 0.
Only files owned by the current user will be displayed. This is useful if the user is being asked to choose a file for a chmod or chgrp operation, for example. The default is 0.
Three problem filenames will, if present in your file-system, cause confusion. They are Create New File, Show DotFiles and Hide DotFiles
Peter J Billam <peter@pjb.com.au>
Based on an old Perl4 library, filemgr.pl, with the options modelled after Tk::FileDialog and Tk::SimpleFileSelect.
http://www.pjb.com.au/, http://www.cpan.org/SITES.html, Term::Clui, Tk::FileDialog, Tk::SimpleFileSelect, perl(1).
To install Term::Clui, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Term::Clui
CPAN shell
perl -MCPAN -e shell install Term::Clui
For more information on module installation, please visit the detailed CPAN module installation guide.