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