1Term::Clui::FileSelect(U3s)er Contributed Perl DocumentatTieornm::Clui::FileSelect(3)
2
3
4
6 Term::Clui::FileSelect - Perl module to ask the user to select a file.
7
9 use Term::Clui::FileSelect;
10 $file = &select_file(-Readable=>1, -TopDir=>"/home", -FPat=>"*.html");
11 @files = &select_file(-Chdir=>0, -Path=>$ENV{PWD}, -FPat=>"*.mp3");
12 chdir &select_file(-Directory=>1, -Path=>$ENV{PWD});
13
15 This module asks the user to select a file from the filesystem. It
16 uses the Command-line user-interface Term::Clui to dialogue with the
17 user. It offers Rescan and ShowAll buttons. To ease the re-learning
18 burden for the programmer, the options are modelled on those of
19 Tk::FileDialog and of Tk::SimpleFileSelect, but various new options are
20 introduced, namely -TopDir, -TextFile, -Readable, -Writeable,
21 -Executable, -Owned and -Directory
22
23 Multiple choice is possible in a limited circumstance; when file_select
24 is invoked in a list context, with -Chdir=>0 and without -Create. It
25 is currently not possible to select multiple files lying in different
26 directories.
27
29 select_file( %options );
30
32 -Chdir
33 Enable the user to change directories. The default is 1. If it is
34 set to 0, and select_file is invoked in a list context, and -Create
35 is not set, then the user can select multiple files.
36
37 -Create
38 Enable the user to specify a file that does not exist. The default
39 is 0.
40
41 -ShowAll or -dotfiles
42 Determines whether hidden files (.*) are displayed. The default is
43 0.
44
45 -DisableShowAll
46 Disables the ability of the user to change the status of the ShowAll
47 flag. The default is 0 (i.e. the user is by default allowed to
48 change the status).
49
50 -SelDir
51 If True, enables selection of a directory rather than a file. The
52 default is 0. To enforce selection of a directory, use the
53 -Directory option.
54
55 -FPat or -filter
56 Sets the default file selection pattern, in glob format, e.g.
57 *.html. Only files matching this pattern will be displayed. If you
58 want multiple patterns, you can use formats like *.[ch] or
59 {*.cgi,*.pl} - see File::Glob for more details. The default is "*".
60
61 -File
62 The file selected, or the default file. The default default is
63 whatever the user selected last time in this directory.
64
65 -Path or -initialdir
66 The path of the selected file, or the initial path. The default is
67 $ENV{HOME}.
68
69 -Title
70 The Title of the dialog box. If -Title is specified, then
71 Clui::FileSelect dynamically appends "in /where/ever" to it. If
72 -Title is not specified, Clui::FileSelect displays "in directory
73 /where/ever".
74
75 -TopDir
76 Restricts the user to remain within a directory or its
77 subdirectories. The default is "/". This option, and the
78 following, are not offered by Tk::FileDialog.
79
80 -TextFile
81 Only text files will be displayed. The default is 0.
82
83 -Readable
84 Only readable files will be displayed. The default is 0.
85
86 -Writeable
87 Only writeable files will be displayed. The default is 0.
88
89 -Executable
90 Only executable files will be displayed. The default is 0.
91
92 -Owned
93 Only files owned by the current user will be displayed. This is
94 useful if the user is being asked to choose a file for a chmod or
95 chgrp operation, for example. The default is 0.
96
97 -Directory
98 Only directories will be displayed. The default is 0.
99
101 Three problem filenames will, if present in your file-system, cause
102 confusion. They are Create New File, Show DotFiles and Hide DotFiles
103
105 Original author:
106
107 Peter J Billam www.pjb.com.au/comp/contact.html
108
109 Current maintainer:
110
111 Graham Ollis
112
114 Based on an old Perl4 library, filemgr.pl, with the options modelled
115 after Tk::FileDialog and Tk::SimpleFileSelect.
116
118 http://www.pjb.com.au/ , http://search.cpan.org/~pjb , File::Glob ,
119 Term::Clui , Tk::FileDialog , Tk::SimpleFileSelect , perl(1) .
120
121
122
123perl v5.34.0 2021-07-23 Term::Clui::FileSelect(3)