SelFile - a widget for choosing a file to read or write
require 5.001; use Tk; use SelFile; $mw = MainWindow->new; # For example. $start_dir = "."; $sfw = $mw->SelFile( -directory => $start_dir, -width => 30, -height => 20, -filelistlabel => 'Files', -filter => '*', -filelabel => 'File', -dirlistlabel => 'Directories', -dirlabel => 'Filter', ); A call with fewer (or no options) such as shown below will result in the default values shown above. $sfw = $mw->SelFile; In a callback bound to an event the user can invoke the widget to request a file selection with the following line. ($opcode, $filename) = $sfw->show; $opcode will have the value 'READ', 'WRITE' or 'CANCEL'. $filename will be a file pathname, or in the case of CANCEL it will be a single space character.
This Module pops up a Fileselector box, with a directory entry with filter on top, a list of directories in the current directory, a list of files in the current directory, an entry for entering or modifying a file name, a read button, a write button, and a cancel button. If your system administrator does not have time to install this package, you could put it into a directory such as $HOME/Myperl (with the name SelFile.pm) and at the top of any Perl script have the following BEGIN { @INC = ("$ENV{'HOME'}/Myperl", @INC); }
Based on original FileSelect by Klaus Lichtenwalder, Lichtenwalder@ACM.org, Datapat GmbH, Munich, April 22, 1995 adapted by Frederick L. Wagner, derf@ti.com, Texas Instruments Incorporated, Dallas, 21Jun95 further adapted by Alan Louis Scheinine, scheinin@crs4.it, Centro di Ricerca, Sviluppo e Studi Superiori in Sardegna (CRS4) Cagliari, 14 November 1995
To install ptkFAQ, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ptkFAQ
CPAN shell
perl -MCPAN -e shell install ptkFAQ
For more information on module installation, please visit the detailed CPAN module installation guide.