-
-
03 Apr 2021 03:19:12 UTC
- Distribution: Complete-Module
- Module version: 0.262
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues
- Testers (2760 / 0 / 0)
- Kwalitee
Bus factor: 1- 96.58% Coverage
- License: perl_5
- Perl: v5.10.1
- Activity
24 month- Tools
- Download (20.37KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- NAME
- VERSION
- SYNOPSIS
- SETTINGS
- FUNCTIONS
- ENVIRONMENT
- HOMEPAGE
- SOURCE
- BUGS
- SEE ALSO
- AUTHOR
- COPYRIGHT AND LICENSE
NAME
Complete::Module - Complete with installed Perl module names
VERSION
This document describes version 0.262 of Complete::Module (from Perl distribution Complete-Module), released on 2021-02-06.
SYNOPSIS
use Complete::Module qw(complete_module); my $res = complete_module(word => 'Text::A'); # -> ['Text::ANSI', 'Text::ANSITable', 'Text::ANSITable::', 'Text::Abbrev']
SETTINGS
$Complete::Module::OPT_SHORTCUT_PREFIXES
=> hashShortcut prefixes. The default is:
{ bs => "Bencher/Scenario/", bss => "Bencher/Scenarios/", df => "DateTime/Format/", dz => "Dist/Zilla/", dzb => "Dist/Zilla/PluginBundle/", dzp => "Dist/Zilla/Plugin/", dzr => "Dist/Zilla/Role/", pw => "Pod/Weaver/", pwb => "Pod/Weaver/PluginBundle/", pwp => "Pod/Weaver/Plugin/", pwr => "Pod/Weaver/Role/", pws => "Pod/Weaver/Section/", rp => "Regexp/Pattern/", }
If user types one of the keys, it will be replaced with the matching value from this hash.
FUNCTIONS
complete_module
Usage:
complete_module(%args) -> any
Complete with installed Perl module names.
For each directory in
@INC
(coderefs are ignored), find Perl modules and module prefixes which haveword
as prefix. So for example, givenTe
asword
, will return e.g.[Template, Template::, Term::, Test, Test::, Text::]
. GivenText::
will return[Text::ASCIITable, Text::Abbrev, ...]
and so on.This function has a bit of overlapping functionality with Module::List, but this function is geared towards shell tab completion. Compared to Module::List, here are some differences: 1) list modules where prefix is incomplete; 2) interface slightly different; 3) (currently) doesn't do recursing; 4) contains conveniences for completion, e.g. map casing, expand intermediate paths (see
Complete
for more details on those features), autoselection of path separator character, some shortcuts, and so on.This function is not exported by default, but exportable.
Arguments ('*' denotes required arguments):
exclude_dir => bool
exclude_leaf => bool
find_pm => bool (default: 1)
Whether to find .pm files.
find_pmc => bool (default: 1)
Whether to find .pmc files.
find_pod => bool (default: 1)
Whether to find .pod files.
find_prefix => bool (default: 1)
Whether to find module prefixes.
ns_prefix => perl::modname
Namespace prefix.
This is useful if you want to complete module under a specific namespace (instead of the root). For example, if you set
ns_prefix
toDist::Zilla::Plugin
(orDist::Zilla::Plugin::
) and word isF
, you can get['FakeRelease', 'FileFinder::', 'FinderCode']
(those are modules under theDist::Zilla::Plugin::
namespace).ns_prefixes => array[perl::modname]
Namespace prefixes.
If you specify this instead of
ns_prefix
, then the routine will search from all the prefixes instead of just one.path_sep => str
Path separator.
For convenience in shell (bash) completion, instead of defaulting to
::
all the time, will look atword
. If word does not contain any::
then will default to/
. This is because::
(contains colon) is rather problematic as it is by default a word-break character in bash and the word needs to be quoted to avoid word-breaking by bash.recurse => bool
recurse_matching => str (default: "level-by-level")
word* => str (default: "")
Word to complete.
Return value: (any)
ENVIRONMENT
COMPLETE_MODULE_OPT_SHORTCUT_PREFIXES
=> strCan be used to set the default for
$Complete::Module::OPT_SHORTCUT_PREFIXES
. It should be in the form of:shortcut1=Value1;shortcut2=Value2;...
For example:
dzp=Dist/Zilla/Plugin/;pwp=Pod/Weaver/Plugin/
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/Complete-Module.
SOURCE
Source repository is at https://github.com/perlancar/perl-Complete-Module.
BUGS
Please report any bugs or feature requests on the bugtracker website https://github.com/perlancar/perl-Complete-Module/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
SEE ALSO
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2021, 2017, 2015, 2014 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install Complete::Module, copy and paste the appropriate command in to your terminal.
cpanm Complete::Module
perl -MCPAN -e shell install Complete::Module
For more information on module installation, please visit the detailed CPAN module installation guide.