The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Term::Clui::FileSelect.pm - Perl module to ask the user to select a file.

SYNOPSIS

  use Term::Clui::FileSelect;
  $file = &select_file(-Readable=>1, -TopDir=>'/home/www', -FPat='*.html');

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 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.

SUBROUTINES

select_file( %options );

OPTIONS

-Chdir

Enable the user to change directories. The default is 1.

-Create

Enable the user to specify a file that does not exist. The default is 0.

-ShowAll or -dotfiles

Determines whether hidden files (.*) are displayed. The default is 0.

-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).

-SelDir

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 . . .

-FPat or -filter

Sets the default file selection pattern, in 'glob' format, e.g. *.html. Only files matching this pattern will be displayed. The default is '*'.

-File

The file selected, or the default file. The default default is whatever the user selected last time in this directory.

-Path or -initialdir

The path of the selected file, or the initial path. The default is $ENV{'HOME'}.

-Title

The Title of the dialog box. The default is 'in directory /where/ever'.

-TopDir

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.

-TextFile

Only text files will be displayed. The default is 0.

-Readable

Only readable files will be displayed. The default is 0.

-Writeable

Only writeable files will be displayed. The default is 0.

-Executable

Only executable files will be displayed. The default is 0.

-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 chmod or chgrp operation, for example. The default is 0.

BUGS

Three problem filenames will, if present in your file-system, cause confusion. They are Create New File, Show DotFiles and Hide DotFiles

AUTHOR

Peter J Billam <peter@pjb.com.au>

CREDITS

Based on an old Perl4 library, filemgr.pl, with the options modelled after Tk::FileDialog and Tk::SimpleFileSelect.

SEE ALSO

http://www.pjb.com.au/, http://www.cpan.org/SITES.html, Term::Clui, Tk::FileDialog, Tk::SimpleFileSelect, perl(1).