Term::...Select(3pm)

πŸ“¦
version 1.76 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– Term::...Select(3pm) β€” the Term::Clui::FileSelect era πŸ’–

okay bestie, welcome to the manual page for Term::Clui::FileSelect β€” a Perl module that literally just asks a human to pick a file off the filesystem. sit down, hydrate, let's go πŸ¦‹


✨ NAME ✨

Term::Clui::FileSelect β€” a Perl module to ask the user to select a file. no cap, that's the whole job. πŸ‘‘


🌸 SYNOPSIS 🌸

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});

πŸ’… DESCRIPTION πŸ’…

so here's the vibe: this module asks the user to select a file from the filesystem. it does that by talking to them through the command-line user-interface Term::Clui. it ships with Rescan and ShowAll buttons because we're thoughtful like that. πŸ’–

and to ease the re-learning burden for the programmer (that's you, bestie 🫢), the options are modelled on those of Tk::FileDialog and Tk::SimpleFileSelect β€” but with a bunch of new options introduced, namely -TopDir, -TextFile, -Readable, -Writeable, -Executable, -Owned and -Directory. new options, who dis. ✨

Multiple choice is possible in a limited circumstance; when file_select is invoked in a list context, with -Chdir=>0 and without -Create. and it is currently not possible to select multiple files lying in different directories. one directory at a time, babes, that's the boundary. 😭


πŸŽ€ SUBROUTINES πŸŽ€

select_file( %options );

πŸ‘‘ OPTIONS πŸ‘‘

  • -Chdir β€” lets the user change directories. default is 1. and if you set it to 0, and select_file is invoked in a list context, and -Create is not set, then the user can select multiple files. three conditions, all of them, no exceptions. πŸ¦‹
  • -Create β€” lets the user specify a file that does not exist. default is 0. manifesting a file into existence, iconic honestly. ✨
  • -ShowAll or -dotfiles β€” determines whether hidden files (.*) are displayed. default is 0. πŸ™ˆ
  • -DisableShowAll β€” takes away the user's ability to change the status of the ShowAll flag. default is 0, i.e. the user is by default allowed to change the status. so like, by default they can touch it. πŸ’…
  • -SelDir β€” if True, enables selection of a directory rather than a file. default is 0. but if you want to enforce selection of a directory, use the -Directory option instead. different tool, different job, iykyk. πŸŽ€
  • -FPat or -filter β€” sets the default file selection pattern, in glob format, e.g. *.html. only files matching this pattern will be displayed. want multiple patterns? you can use formats like *.[ch] or {*.cgi,*.pl} β€” see File::Glob for more details. default is "*". glob girlies rise 🌈
  • -File β€” the file selected, or the default file. the default default is whatever the user selected last time in this directory. it remembers. it's giving memory. 🧚
  • -Path or -initialdir β€” the path of the selected file, or the initial path. default is $ENV{HOME}. home sweet home. 🏠
  • -Title β€” the Title of the dialog box. if -Title is specified, then Clui::FileSelect dynamically appends "in /where/ever" to it. if -Title is not specified, Clui::FileSelect displays "in directory /where/ever". either way you're getting a where/ever, that's just the deal. πŸ’€
  • -TopDir β€” restricts the user to remain within a directory or its subdirectories. default is "/". this option, and the following ones, are not offered by Tk::FileDialog. we're built different. πŸ”₯
  • -TextFile β€” only text files will be displayed. default is 0. πŸ“„
  • -Readable β€” only readable files will be displayed. default is 0. πŸ‘€
  • -Writeable β€” only writeable files will be displayed. default is 0. ✍️
  • -Executable β€” only executable files will be displayed. 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. default is 0. mine, mine, all mine πŸ’œ
  • -Directory β€” only directories will be displayed. default is 0. πŸ“

πŸ’€ BUGS πŸ’€

three problem filenames will, if present in your file-system, cause confusion. they are: - Create New File - Show DotFiles - Hide DotFiles

so like... if you have those files, godspeed bestie. not our fault, but also, sorry. 😭


🫢 AUTHOR 🫢

Original author:

Peter J Billam β€” www.pjb.com.au/comp/contact.html

Current maintainer:

Graham Ollis


🌟 CREDITS 🌟

based on an old Perl4 library, filemgr.pl, with the options modelled after Tk::FileDialog and Tk::SimpleFileSelect. we stand on the shoulders of legends, fr fr. ✨


🌈 SEE ALSO 🌈


and that's the whole page, bestie!! this was rendered from perl v5.30.0, dated 2019-11-10 β€” so yes, it's vintage, and yes, it still slays. go pick a file. periodt. πŸ’…πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from