Perinci-Examples-Bin-Inline
view release on metacpan or search on metacpan
bin/_peri-eg-noop-inline view on Meta::CPAN
# $CloneCache{ $source } = $copy = $source;
# }
#
# if ( $class_name ) {
# bless $copy, $class_name;
# $copy->$CloneInitMethod() if $copy->can($CloneInitMethod);
# }
#
# return $copy;
#}
#
#1;
#
#__END__
#
### Complete.pm ###
#package Complete;
#
#our $DATE = '2015-09-16';
#our $VERSION = '0.16';
#
#1;
#
#__END__
#
### Complete/Bash.pm ###
#package Complete::Bash;
#
#our $DATE = '2015-09-09';
#our $VERSION = '0.21';
#
#use 5.010001;
#use strict;
#use warnings;
#
#
#require Exporter;
#our @ISA = qw(Exporter);
#our @EXPORT_OK = qw(
# parse_cmdline
# parse_options
# format_completion
# );
#
#our %SPEC;
#
#$SPEC{':package'} = {
# v => 1.1,
# summary => 'Completion module for bash shell',
# links => [
# {url => 'pm:Complete'},
# ],
#};
#
#sub _expand_tilde {
# my ($user, $slash) = @_;
# my @ent;
# if (length $user) {
# @ent = getpwnam($user);
# } else {
# @ent = getpwuid($>);
# $user = $ent[0];
# }
# return $ent[7] . $slash if @ent;
# "~$user$slash";
#}
#
#sub _add_unquoted {
# no warnings 'uninitialized';
#
# my ($word, $is_cur_word, $after_ws) = @_;
#
#
# $word =~ s!^(~)(\w*)(/|\z) | # 1) tilde 2) username 3) optional slash
# \\(.) | # 4) escaped char
# \$(\w+) # 5) variable name
# !
# $1 ? (not($after_ws) || $is_cur_word ? "$1$2$3" : _expand_tilde($2, $3)) :
# $4 ? $4 :
# ($is_cur_word ? "\$$5" : $ENV{$5})
# !egx;
# $word;
#}
#
#sub _add_double_quoted {
# no warnings 'uninitialized';
#
# my ($word, $is_cur_word) = @_;
#
# $word =~ s!\\(.) | # 1) escaped char
# \$(\w+) # 2) variable name
# !
# $1 ? $1 :
# ($is_cur_word ? "\$$2" : $ENV{$2})
# !egx;
# $word;
#}
#
#sub _add_single_quoted {
# my $word = shift;
# $word =~ s/\\(.)/$1/g;
# $word;
#}
#
#$SPEC{parse_cmdline} = {
# v => 1.1,
# summary => 'Parse shell command-line for processing by completion routines',
# description => <<'_',
#
#This function basically converts COMP_LINE (str) and COMP_POINT (int) into
#something like (but not exactly the same as) COMP_WORDS (array) and COMP_CWORD
#(int) that bash supplies to shell functions.
#
#The differences with bash are (these differences are mostly for parsing
#convenience for programs that use this routine):
#
#1) quotes and backslashes are stripped (bash's COMP_WORDS contains all the
#quotes and backslashes);
#
#2) variables are substituted with their values from environment variables except
#for the current word (COMP_WORDS[COMP_CWORD]) (bash does not perform variable
( run in 2.641 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )