.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Term::Clui::FileSelect 3pm" .TH Term::Clui::FileSelect 3pm "2019-11-10" "perl v5.30.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Term::Clui::FileSelect \- Perl module to ask the user to select a file. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& use Term::Clui::FileSelect; \& $file = &select_file(\-Readable=>1, \-TopDir=>"/home", \-FPat=>"*.html"); \& @files = &select_file(\-Chdir=>0, \-Path=>$ENV{PWD}, \-FPat=>"*.mp3"); \& chdir &select_file(\-Directory=>1, \-Path=>$ENV{PWD}); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" 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 \fIRescan\fR and \fIShowAll\fR 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 \fI\-TopDir\fR, \fI\-TextFile\fR, \&\fI\-Readable\fR, \fI\-Writeable\fR, \fI\-Executable\fR, \fI\-Owned\fR and \fI\-Directory\fR .PP Multiple choice is possible in a limited circumstance; when \fIfile_select\fR is invoked in a list context, with \-Chdir=>0 and without \-Create. It is currently not possible to select multiple files lying in different directories. .SH "SUBROUTINES" .IX Header "SUBROUTINES" .ie n .IP "\fIselect_file\fR( %options );" 3 .el .IP "\fIselect_file\fR( \f(CW%options\fR );" 3 .IX Item "select_file( %options );" .SH "OPTIONS" .IX Header "OPTIONS" .PD 0 .IP "\fI\-Chdir\fR" 3 .IX Item "-Chdir" .PD Enable the user to change directories. The default is 1. If it is set to 0, and \fIselect_file\fR is invoked in a list context, and \fI\-Create\fR is not set, then the user can select multiple files. .IP "\fI\-Create\fR" 3 .IX Item "-Create" Enable the user to specify a file that does not exist. The default is 0. .IP "\fI\-ShowAll\fR or \fI\-dotfiles\fR" 3 .IX Item "-ShowAll or -dotfiles" Determines whether hidden files (.*) are displayed. The default is 0. .IP "\fI\-DisableShowAll\fR" 3 .IX Item "-DisableShowAll" 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). .IP "\fI\-SelDir\fR" 3 .IX Item "-SelDir" If True, enables selection of a directory rather than a file. The default is 0. To \fIenforce\fR selection of a directory, use the \fI\-Directory\fR option. .IP "\fI\-FPat\fR or \fI\-filter\fR" 3 .IX Item "-FPat or -filter" Sets the default file selection pattern, in glob format, e.g. \fI*.html\fR. Only files matching this pattern will be displayed. If you want multiple patterns, you can use formats like \&\fI*.[ch]\fR or \&\fI{*.cgi,*.pl}\fR \- see \fIFile::Glob\fR for more details. The default is \*(L"*\*(R". .IP "\fI\-File\fR" 3 .IX Item "-File" The file selected, or the default file. The default default is whatever the user selected last time in this directory. .IP "\fI\-Path\fR or \fI\-initialdir\fR" 3 .IX Item "-Path or -initialdir" The path of the selected file, or the initial path. The default is \f(CW$ENV\fR{\s-1HOME\s0}. .IP "\fI\-Title\fR" 3 .IX Item "-Title" The Title of the dialog box. If \fI\-Title\fR is specified, then Clui::FileSelect dynamically appends "in \fI/where/ever\fR" to it. If \fI\-Title\fR is not specified, Clui::FileSelect displays "in directory \fI/where/ever\fR". .IP "\fI\-TopDir\fR" 3 .IX Item "-TopDir" Restricts the user to remain within a directory or its subdirectories. The default is \*(L"/\*(R". This option, and the following, are not offered by Tk::FileDialog. .IP "\fI\-TextFile\fR" 3 .IX Item "-TextFile" Only text files will be displayed. The default is 0. .IP "\fI\-Readable\fR" 3 .IX Item "-Readable" Only readable files will be displayed. The default is 0. .IP "\fI\-Writeable\fR" 3 .IX Item "-Writeable" Only writeable files will be displayed. The default is 0. .IP "\fI\-Executable\fR" 3 .IX Item "-Executable" Only executable files will be displayed. The default is 0. .IP "\fI\-Owned\fR" 3 .IX Item "-Owned" 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 \fIchmod\fR or \fIchgrp\fR operation, for example. The default is 0. .IP "\fI\-Directory\fR" 3 .IX Item "-Directory" Only directories will be displayed. The default is 0. .SH "BUGS" .IX Header "BUGS" Three problem filenames will, if present in your file-system, cause confusion. They are \fICreate New File\fR, \fIShow DotFiles\fR and \fIHide DotFiles\fR .SH "AUTHOR" .IX Header "AUTHOR" Original author: .PP Peter J Billam www.pjb.com.au/comp/contact.html .PP Current maintainer: .PP Graham Ollis .SH "CREDITS" .IX Header "CREDITS" Based on an old Perl4 library, \fIfilemgr.pl\fR, with the options modelled after \fITk::FileDialog\fR and \fITk::SimpleFileSelect\fR. .SH "SEE ALSO" .IX Header "SEE ALSO" http://www.pjb.com.au/ , http://search.cpan.org/~pjb , File::Glob , Term::Clui , Tk::FileDialog , Tk::SimpleFileSelect , \&\fBperl\fR\|(1) .