view release on metacpan or search on metacpan
inc/Module/Install/Makefile.pm view on Meta::CPAN
sub Makefile { $_[0] }
my %seen = ();
sub prompt {
shift;
# Infinite loop protection
my @c = caller();
if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
}
# In automated testing, always use defaults
if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
local $ENV{PERL_MM_USE_DEFAULT} = 1;
goto &ExtUtils::MakeMaker::prompt;
} else {
goto &ExtUtils::MakeMaker::prompt;
}
}
# Store a cleaned up version of the MakeMaker version,
# since we need to behave differently in a variety of
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Makefile.pm view on Meta::CPAN
sub Makefile { $_[0] }
my %seen = ();
sub prompt {
shift;
# Infinite loop protection
my @c = caller();
if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
}
# In automated testing, always use defaults
if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
local $ENV{PERL_MM_USE_DEFAULT} = 1;
goto &ExtUtils::MakeMaker::prompt;
} else {
goto &ExtUtils::MakeMaker::prompt;
}
}
# Store a cleaned up version of the MakeMaker version,
# since we need to behave differently in a variety of
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Makefile.pm view on Meta::CPAN
sub Makefile { $_[0] }
my %seen = ();
sub prompt {
shift;
# Infinite loop protection
my @c = caller();
if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
}
# In automated testing, always use defaults
if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
local $ENV{PERL_MM_USE_DEFAULT} = 1;
goto &ExtUtils::MakeMaker::prompt;
} else {
goto &ExtUtils::MakeMaker::prompt;
}
}
# Store a cleaned up version of the MakeMaker version,
# since we need to behave differently in a variety of
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Makefile.pm view on Meta::CPAN
sub Makefile { $_[0] }
my %seen = ();
sub prompt {
shift;
# Infinite loop protection
my @c = caller();
if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
}
# In automated testing, always use defaults
if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
local $ENV{PERL_MM_USE_DEFAULT} = 1;
goto &ExtUtils::MakeMaker::prompt;
} else {
goto &ExtUtils::MakeMaker::prompt;
}
}
# Store a cleaned up version of the MakeMaker version,
# since we need to behave differently in a variety of
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/AutoInstall.pm view on Meta::CPAN
$TestOnly = 1;
}
}
}
# overrides MakeMaker's prompt() to automatically accept the default choice
sub _prompt {
goto &ExtUtils::MakeMaker::prompt unless $AcceptDefault;
my ( $prompt, $default ) = @_;
my $y = ( $default =~ /^[Yy]/ );
print $prompt, ' [', ( $y ? 'Y' : 'y' ), '/', ( $y ? 'n' : 'N' ), '] ';
print "$default\n";
return $default;
}
# the workhorse
inc/Module/AutoInstall.pm view on Meta::CPAN
if (
!$SkipInstall
and (
$CheckOnly
or _prompt(
qq{==> Auto-install the }
. ( @required / 2 )
. ( $mandatory ? ' mandatory' : ' optional' )
. qq{ module(s) from CPAN?},
$default ? 'y' : 'n',
inc/Module/AutoInstall.pm view on Meta::CPAN
elsif ( !$SkipInstall
and $default
and $mandatory
and
_prompt( qq{==> The module(s) are mandatory! Really skip?}, 'n', )
=~ /^[Nn]/ )
{
push( @Missing, @required );
$DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
}
inc/Module/AutoInstall.pm view on Meta::CPAN
return
if defined( _version_check( _load($class), $ver ) ); # no need to upgrade
if (
_prompt( "==> A newer version of $class ($ver) is required. Install?",
'y' ) =~ /^[Nn]/
)
{
die "*** Please install $class $ver manually.\n";
}
inc/Module/AutoInstall.pm view on Meta::CPAN
# check if we're connected to some host, using inet_aton
sub _connected_to {
my $site = shift;
return (
( _load('Socket') and Socket::inet_aton($site) ) or _prompt(
qq(
*** Your host cannot resolve the domain name '$site', which
probably means the Internet connections are unavailable.
==> Should we try to install the required module(s) anyway?), 'n'
) =~ /^[Yy]/
inc/Module/AutoInstall.pm view on Meta::CPAN
*** You are not allowed to write to the directory '$path';
the installation may fail due to insufficient permissions.
.
if (
eval '$>' and lc(`sudo -V`) =~ /version/ and _prompt(
qq(
==> Should we try to re-execute the autoinstall process with 'sudo'?),
((-t STDIN) ? 'y' : 'n')
) =~ /^[Yy]/
)
inc/Module/AutoInstall.pm view on Meta::CPAN
print << ".";
*** The 'sudo' command exited with error! Resuming...
.
}
return _prompt(
qq(
==> Should we try to install the required module(s) anyway?), 'n'
) =~ /^[Yy]/;
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Makefile.pm view on Meta::CPAN
sub Makefile { $_[0] }
my %seen = ();
sub prompt {
shift;
# Infinite loop protection
my @c = caller();
if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
}
# In automated testing or non-interactive session, always use defaults
if ( ($ENV{AUTOMATED_TESTING} or -! -t STDIN) and ! $ENV{PERL_MM_USE_DEFAULT} ) {
local $ENV{PERL_MM_USE_DEFAULT} = 1;
goto &ExtUtils::MakeMaker::prompt;
} else {
goto &ExtUtils::MakeMaker::prompt;
}
}
# Store a cleaned up version of the MakeMaker version,
# since we need to behave differently in a variety of
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Makefile.pm view on Meta::CPAN
sub Makefile { $_[0] }
my %seen = ();
sub prompt {
shift;
# Infinite loop protection
my @c = caller();
if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
}
# In automated testing or non-interactive session, always use defaults
if ( ($ENV{AUTOMATED_TESTING} or -! -t STDIN) and ! $ENV{PERL_MM_USE_DEFAULT} ) {
local $ENV{PERL_MM_USE_DEFAULT} = 1;
goto &ExtUtils::MakeMaker::prompt;
} else {
goto &ExtUtils::MakeMaker::prompt;
}
}
# Store a cleaned up version of the MakeMaker version,
# since we need to behave differently in a variety of
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/AutoInstall.pm view on Meta::CPAN
$AllDeps = 1;
}
}
}
# overrides MakeMaker's prompt() to automatically accept the default choice
sub _prompt {
goto &ExtUtils::MakeMaker::prompt unless $AcceptDefault;
my ( $prompt, $default ) = @_;
my $y = ( $default =~ /^[Yy]/ );
print $prompt, ' [', ( $y ? 'Y' : 'y' ), '/', ( $y ? 'n' : 'N' ), '] ';
print "$default\n";
return $default;
}
# the workhorse
inc/Module/AutoInstall.pm view on Meta::CPAN
map { +{@args}->{$_} }
grep { /^[^\-]/ or /^-core$/i } keys %{ +{@args} }
)[0]
);
# We want to know if we're under CPAN early to avoid prompting, but
# if we aren't going to try and install anything anyway then skip the
# check entirely since we don't want to have to load (and configure)
# an old CPAN just for a cosmetic message
$UnderCPAN = _check_lock(1) unless $SkipInstall || $InstallDepsTarget;
inc/Module/AutoInstall.pm view on Meta::CPAN
and (
$CheckOnly
or ($mandatory and $UnderCPAN)
or $AllDeps
or $InstallDepsTarget
or _prompt(
qq{==> Auto-install the }
. ( @required / 2 )
. ( $mandatory ? ' mandatory' : ' optional' )
. qq{ module(s) from CPAN?},
$default ? 'y' : 'n',
inc/Module/AutoInstall.pm view on Meta::CPAN
elsif ( !$SkipInstall
and $default
and $mandatory
and
_prompt( qq{==> The module(s) are mandatory! Really skip?}, 'n', )
=~ /^[Nn]/ )
{
push( @Missing, @required );
$DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
}
inc/Module/AutoInstall.pm view on Meta::CPAN
return
if _version_cmp( _version_of($class), $ver ) >= 0; # no need to upgrade
if (
_prompt( "==> A newer version of $class ($ver) is required. Install?",
'y' ) =~ /^[Nn]/
)
{
die "*** Please install $class $ver manually.\n";
}
inc/Module/AutoInstall.pm view on Meta::CPAN
# check if we're connected to some host, using inet_aton
sub _connected_to {
my $site = shift;
return (
( _load('Socket') and Socket::inet_aton($site) ) or _prompt(
qq(
*** Your host cannot resolve the domain name '$site', which
probably means the Internet connections are unavailable.
==> Should we try to install the required module(s) anyway?), 'n'
) =~ /^[Yy]/
inc/Module/AutoInstall.pm view on Meta::CPAN
*** You are not allowed to write to the directory '$path';
the installation may fail due to insufficient permissions.
.
if (
eval '$>' and lc(`sudo -V`) =~ /version/ and _prompt(
qq(
==> Should we try to re-execute the autoinstall process with 'sudo'?),
((-t STDIN) ? 'y' : 'n')
) =~ /^[Yy]/
)
inc/Module/AutoInstall.pm view on Meta::CPAN
print << ".";
*** The 'sudo' command exited with error! Resuming...
.
}
return _prompt(
qq(
==> Should we try to install the required module(s) anyway?), 'n'
) =~ /^[Yy]/;
}
view all matches for this distribution
view release on metacpan or search on metacpan
Similar to the --config option except this passes strings which are
passed to either the './Build' or 'make' command used to actually
build the module. This option can be passed in any number of times.
--config-input STRING
Sometimes, the configure step prompts for input that cannot be set
using an environment variable. In this case, this option may be used
to pass in a single line of input to the 'perl Build.PL' or 'perl
Makefile.PL' command used to configure the module and create a Build
script or a Makefile. This option can be passed in any number of
times, but each value should include a single line of input. This
view all matches for this distribution
view release on metacpan or search on metacpan
inc/My/Module/Build.pm view on Meta::CPAN
=back
=head3 Dependent Option Graph
This feature wraps around L<Module::Build/prompt>,
L<Module::Build/get_options> and L<Module::Build/notes> to streamline
the programming of optional features into a ./Build.PL script. Here is
a short synopsis for this feature:
=for My::Tests::Below "option-graph" begin
inc/My/Module/Build.pm view on Meta::CPAN
default.
=item I<mandatory>
A Boolean indicating whether answering the question with a non-empty
value is mandatory (see also L</prompt> for a twist on what
"non-empty" exactly means). The default mandatoryness is 1 if
I<default> is not returned, 0 if I<default> is returned (even with an
undef value).
=back
inc/My/Module/Build.pm view on Meta::CPAN
}
}
=item I<show_warning($message)>
Displays a multi-line message $message to the user, and prompts
him/her to "Press RETURN to continue".
=cut
sub show_warning {
my ($self, $message) = @_;
$message = "\n$message" until ($message =~ m/^\n\n/);
$message .= "\n" until ($message =~ m/\n\n$/);
warn $message;
$self->prompt("Press RETURN to continue");
1;
}
=item I<show_fatal_error($message)>
inc/My/Module/Build.pm view on Meta::CPAN
if ($self->_option_type($key) eq "boolean") {
$default = $default ? "yes" : "no";
}
ASK_AGAIN: {
my $answer = $self->prompt($question, $default);
my $problem = $self->_option_check_value($key, \$answer);
return $answer if (! $problem);
if (-t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT))) {
warn $problem;
inc/My/Module/Build.pm view on Meta::CPAN
my ($self, $k, @v) = @_;
if (@v) { $self->{notes}->{$k} = $v[0]; }
return $self->{notes}->{$k};
}
# "batch" version of ->prompt()
our %answers = ("Install module foo?" => 1);
sub prompt {
my ($self, $question) = @_;
die "Unexpected question $question" if
(! exists $answers{$question});
return delete $answers{$question}; # Will not answer twice
# the same question
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/ChangeShebang.pm view on Meta::CPAN
sub run ($self) {
for my $file ($self->{file}->@*) {
next unless -f $file && !-l $file;
next unless $self->is_perl_shebang( $file );
unless ($self->{force}) {
my $anser = ExtUtils::MakeMaker::prompt( "change shebang line of $file? (y/N)", "N" );
next if $anser !~ /^y(es)?$/i;
}
$self->change_shebang($file);
warn "changed shebang line of $file\n" unless $self->{quiet};
}
view all matches for this distribution
view release on metacpan or search on metacpan
CODE_OF_CONDUCT.md view on Meta::CPAN
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
yanick@babyl.ca.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
view all matches for this distribution
view release on metacpan or search on metacpan
doc/chart.texi view on Meta::CPAN
running Chart GUI@. So if you have both open then changes in one are
reflected in the other a moment later.
@findex @code{chart-quote}
@kbd{M-x chart-quote} displays a quote for a given symbol in the message area.
It prompts for the symbol with default a symbol at point. @key{Tab}
completion is available (@pxref{Completion,,, emacs, The Emacs Editor}) using
the database symbols, favourites list, and previously requested symbols.
@findex @code{chart-quote-at-point}
@kbd{M-x chart-quote-at-point} displays a quote for the symbol at point,
without prompting.
The language, date formats, etc, follow the Chart locale selection described
in @ref{Internationalization}. Emacs @kbd{M-x set-language-environment} and
other Emacs setups don't influence the display.
view all matches for this distribution
view release on metacpan or search on metacpan
#############################################################
## Batch - Conditions
#############################################################
# If statement in windows 10 DOS (windows 10, command prompt)
if exist "C:\Program Files\Git\usr\bin\perl2.exe" (echo FOUND) else (echo not found)
# Batch check if file/folder exists (windows,dos)
set folder=D:\my\ncfile\dev\assets
echo %folder%
) ELSE (
echo No;
echo 456;
)
# If else statement in windows 10 DOS (windows 10, command prompt)
if "%val%" == "-1" (
echo.
echo Error: No tool provided! tool="%tool%"
echo.
) else (
#############################################################
## Batch - Foreach Loop
#############################################################
# Windows 10 dos command prompt for each loop
for %a in (path-a, path-b, path-c) do (@echo %a)
#
# Use %%a inside a script (%a on the command line)
for %%a in (
path-a,
#############################################################
## Batch - Strings
#############################################################
# Remove double quotes from a variable in dos (windows 10, command prompt)
set a="here is data"
set a=%a:"=%
echo %a%
#############################################################
## Batch - Terminal
#############################################################
# Change the title of the command prompt window
title MY_TITLE
# Change the dimentions/size of a commmand prompt window (length,width)
mode con: cols=80 lines=10
# Temporarily chang ethe command prompt language to english
set LANG=US
# Enable ANSI colors in Windows 10 using system '' (magic!?)
perl -E "system ''; say qq(\033[35mHEY\033[0m)"
sudo make -C /var/yp
# Change root password
sudo passwd root
# Reset password in a script with no prompt (change)
# Can only supply one user to "passwd"
echo asdf1234 | sudo passwd xbe4092 --stdin; sudo make -C /var/yp
echo -e "xbe4092:asdf1234\npotapov:asdf1234" | sudo chpasswd; sudo make -C /var/yp
# Reset password over ssh (change,admin)
rm -f RCS/,file_name
# RCS error: file locked by pwxxxx
rcs -U file
# RCS: check in a file initially without the prompt message
ci -t-msg tiny2_rcs.tst
#############################################################
## Linux Commands - read
echo $TERM
# Wrap long lines unto next row in bash/linux
# Exclose PS1 in '\[PS1_VALUE\]'
# Function which run on each prompt.
PROMPT_COMMAND=__prompt_command
__prompt_command ()
{
local EXIT="$?";
PS1=$_PS1;
if [ $EXIT != 0 ]; then
PS1+=$RED$'\u2716'$RESTORE
cat ~/junk/exceptions | while read n; do diff $n~ $n -qs; done
cat ~/junk/exceptions | while read n; do git diff $n~ $n; done
# Setup vimdiff as the default difftool
git config --global diff.tool vimdiff
git config --global difftool.prompt false
# Use vimdiff for seeing changes in git
git difftool commit1 commit2 file
# Ignore whitespace
1 - Disabled
0 - Enabled
#
# Restart PC for changes to take effect.
# Add the "Open command window here" option back to windows 10 commamd prompt (registry,DOS)
# when doing right click.
#
# Go to the regestry
Win + r
type: regedit
view all matches for this distribution
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
unless (eval "use Module::Build::Compat 0.02; 1" ) {
print "This module requires Module::Build to install itself.\n";
require ExtUtils::MakeMaker;
my $yn = ExtUtils::MakeMaker::prompt
(' Install Module::Build now from CPAN?', 'y');
unless ($yn =~ /^y/i) {
die " *** Cannot install without Module::Build. Exiting ...\n";
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Chit/Command/chat.pm view on Meta::CPAN
}
sub opt_spec {
return (
[ "temperature=f", "temperature for response" ],
[ "stdin", "prompt from STDIN" ],
[ "file=s", "prompt from file" ],
);
}
sub validate_args ( $self, $opt, $args ) {
unless ( $opt->{stdin} or $opt->{file} ) {
$self->usage_error( "expected a prompt on the command line, or -i, or -f" )
unless ( @$args == 1 and length($args->[0]) > 2 );
}
$self->usage_error( "cannot use both -i and -f" )
if ( $opt->{stdin} and $opt->{file} );
lib/App/Chit/Command/chat.pm view on Meta::CPAN
'colorcycle' => 1,
) if -t STDOUT;
$spin->auto_start if $spin;
my $prompt = do {
if ( $opt->{stdin} ) {
local $/;
<STDIN>;
}
elsif ( $opt->{file} ) {
lib/App/Chit/Command/chat.pm view on Meta::CPAN
}
else {
$args->[0];
}
};
chomp $prompt;
my @log = @{ $chit->{chat} or [] };
unshift @log, { role => 'system', content => $chit->{role} };
push @log, { role => 'user', content => $prompt };
my $temperature = $opt->{temperature} // $chit->{temperature};
my $gpt = App::Chit::Util::chatgpt( $chit );
my $response = $gpt->chat( \@log, $temperature );
$spin->auto_done if $spin;
if ( defined $response ) {
chomp $response;
say $response;
push @{ $chit->{chat} //= [] },
{ role => 'user', content => $prompt },
{ role => 'assistant', content => $response };
}
else {
croak( "Error: " . $gpt->error );
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/AutoInstall.pm view on Meta::CPAN
$AllDeps = 1;
}
}
}
# overrides MakeMaker's prompt() to automatically accept the default choice
sub _prompt {
goto &ExtUtils::MakeMaker::prompt unless $AcceptDefault;
my ( $prompt, $default ) = @_;
my $y = ( $default =~ /^[Yy]/ );
print $prompt, ' [', ( $y ? 'Y' : 'y' ), '/', ( $y ? 'n' : 'N' ), '] ';
print "$default\n";
return $default;
}
# the workhorse
inc/Module/AutoInstall.pm view on Meta::CPAN
map { +{@args}->{$_} }
grep { /^[^\-]/ or /^-core$/i } keys %{ +{@args} }
)[0]
);
# We want to know if we're under CPAN early to avoid prompting, but
# if we aren't going to try and install anything anyway then skip the
# check entirely since we don't want to have to load (and configure)
# an old CPAN just for a cosmetic message
$UnderCPAN = _check_lock(1) unless $SkipInstall;
inc/Module/AutoInstall.pm view on Meta::CPAN
!$SkipInstall
and (
$CheckOnly
or ($mandatory and $UnderCPAN)
or $AllDeps
or _prompt(
qq{==> Auto-install the }
. ( @required / 2 )
. ( $mandatory ? ' mandatory' : ' optional' )
. qq{ module(s) from CPAN?},
$default ? 'y' : 'n',
inc/Module/AutoInstall.pm view on Meta::CPAN
elsif ( !$SkipInstall
and $default
and $mandatory
and
_prompt( qq{==> The module(s) are mandatory! Really skip?}, 'n', )
=~ /^[Nn]/ )
{
push( @Missing, @required );
$DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
}
inc/Module/AutoInstall.pm view on Meta::CPAN
return
if _version_cmp( _load($class), $ver ) >= 0; # no need to upgrade
if (
_prompt( "==> A newer version of $class ($ver) is required. Install?",
'y' ) =~ /^[Nn]/
)
{
die "*** Please install $class $ver manually.\n";
}
inc/Module/AutoInstall.pm view on Meta::CPAN
# check if we're connected to some host, using inet_aton
sub _connected_to {
my $site = shift;
return (
( _load('Socket') and Socket::inet_aton($site) ) or _prompt(
qq(
*** Your host cannot resolve the domain name '$site', which
probably means the Internet connections are unavailable.
==> Should we try to install the required module(s) anyway?), 'n'
) =~ /^[Yy]/
inc/Module/AutoInstall.pm view on Meta::CPAN
*** You are not allowed to write to the directory '$path';
the installation may fail due to insufficient permissions.
.
if (
eval '$>' and lc(`sudo -V`) =~ /version/ and _prompt(
qq(
==> Should we try to re-execute the autoinstall process with 'sudo'?),
((-t STDIN) ? 'y' : 'n')
) =~ /^[Yy]/
)
inc/Module/AutoInstall.pm view on Meta::CPAN
print << ".";
*** The 'sudo' command exited with error! Resuming...
.
}
return _prompt(
qq(
==> Should we try to install the required module(s) anyway?), 'n'
) =~ /^[Yy]/;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Cleo/Patra.pm view on Meta::CPAN
$self->do_cmd($cmd) and next CMD
if $run_in_background;
no warnings 'redundant';
my $prompt_state = $self->{state};
print sprintf $self->{$prompt_state}, $i;
my @steps = split /%%%/, $cmd;
while (my $step = shift @steps) {
my $should_pause = !($keep_going || $continue_to_end);
lib/App/Cleo/Patra.pm view on Meta::CPAN
Number of microseconds to wait before displaying each character of the command.
The default is C<25_000>.
=item ps1
String to use for the artificial prompt. The token C<%d> will be substituted
with the number of the current command. The default is C<(%d)$>.
=item ps2
String to use for the artificial prompt that appears for multiline commands. The
token C<%d> will be substituted with the number of the current command. The
default is C<< > >>.
=item shell
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Cleo.pm view on Meta::CPAN
sub new {
my $class = shift;
my $self = {
shell => $ENV{SHELL} || '/bin/bash',
prompt => colored( ['green'], '(%d)$ '),
delay => 25_000,
@_,
};
return bless $self, $class;
lib/App/Cleo.pm view on Meta::CPAN
chomp $cmd;
$self->do_cmd($cmd) and next CMD
if $cmd =~ s/^!!!//;
print sprintf $self->{prompt}, $i;
my @steps = split /%%%/, $cmd;
while (my $step = shift @steps) {
my $key = ReadKey(0);
lib/App/Cleo.pm view on Meta::CPAN
=item delay
Number of milliseconds to wait before displaying each character of the command.
The default is C<25_000>.
=item prompt
String to use for the artificial prompt. The token C<%d> will be substituted
with the number of the current command. The default is C<(%d)$>.
=item shell
Path to the shell command that will be used to run the commands. Defaults to
view all matches for this distribution
view release on metacpan or search on metacpan
bin_PL/cscp.x view on Meta::CPAN
The .cfg file can have a parameter set LOG=/path/to/log. If so, it logs the
action to that file by appending to the end of it.
SSH w/o PASSWORDS
If ssh public/private key authentication is setup with no passphrase then no password is neccessary to scp the files. Otherwise you will be prompted for each server password.
FOO
}
copy_files()
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Cmd/Plugin/Prompt.pm view on Meta::CPAN
use strict;
use warnings;
package App::Cmd::Plugin::Prompt 1.006;
# ABSTRACT: plug prompting routines into your commands
use App::Cmd::Setup -plugin => {
exports => [ qw(prompt_str prompt_yn prompt_any_key) ],
};
use Term::ReadKey;
#pod =head1 SYNOPSIS
lib/App/Cmd/Plugin/Prompt.pm view on Meta::CPAN
#pod use MyApp -command;
#pod
#pod sub run {
#pod my ($self, $opt, $args) = @_;
#pod
#pod return unless prompt_yn('really do stuff?', { default => 1 });
#pod
#pod ...
#pod }
#pod
#pod =head1 SUBROUTINES
#pod
#pod =head2 prompt_str
#pod
#pod my $input = prompt_str($prompt, \%opt)
#pod
#pod This prompts a user for string input. It can be directed to
#pod persist until input is 'acceptable'.
#pod
#pod Valid options are:
#pod
#pod =over 4
lib/App/Cmd/Plugin/Prompt.pm view on Meta::CPAN
#pod user's response; default is to read from STDIN.
#pod
#pod =item *
#pod
#pod B<output:> optional coderef, which, when invoked (with two
#pod arguments: the prompt and the choices/default), should
#pod prompt the user; default is to write to STDOUT.
#pod
#pod =item *
#pod
#pod B<valid:> an optional coderef which any input is passed into
#pod and which must return true in order for the program to
lib/App/Cmd/Plugin/Prompt.pm view on Meta::CPAN
#pod B<default:> may be any string; must pass the 'valid' coderef
#pod (if given)
#pod
#pod =item *
#pod
#pod B<choices:> what to display after the prompt; default is
#pod either the 'default' parameter or nothing
#pod
#pod =item *
#pod
#pod B<no_valid_default:> do not test the 'default' parameter
lib/App/Cmd/Plugin/Prompt.pm view on Meta::CPAN
#pod
#pod =back
#pod
#pod =cut
sub prompt_str {
my ($plugin, $cmd, $message, $opt) = @_;
if ($opt->{default} && $opt->{valid} && ! $opt->{no_valid_default}) {
Carp::croak(
$opt->{invalid_default_error} || "'default' must pass 'valid' parameter"
) unless $opt->{valid}->($opt->{default});
lib/App/Cmd/Plugin/Prompt.pm view on Meta::CPAN
}
}
return $response;
}
#pod =head2 prompt_yn
#pod
#pod my $bool = prompt_yn($prompt, \%opt);
#pod
#pod This prompts the user for a yes or no response and won't give up until it gets
#pod one. It returns true for yes and false for no.
#pod
#pod Valid options are:
#pod
#pod default: may be yes or no, indicating how to interpret an empty response;
#pod if empty, require an explicit answer; defaults to empty
#pod
#pod =cut
sub prompt_yn {
my ($plugin, $cmd, $message, $opt) = @_;
Carp::croak("default must be y or n or 0 or 1")
if defined $opt->{default}
and $opt->{default} !~ /\A[yn01]\z/;
lib/App/Cmd/Plugin/Prompt.pm view on Meta::CPAN
my $default = ($opt->{default}||'') =~ /\A\d\z/
? ($opt->{default} ? 'y' : 'n')
: $opt->{default};
my $response = $plugin->prompt_str(
$cmd,
$message,
{
choices => $choices,
valid => sub { lc($_[0]) eq 'y' || lc($_[0]) eq 'n' },
lib/App/Cmd/Plugin/Prompt.pm view on Meta::CPAN
);
return lc($response) eq 'y';
}
#pod =head2 prompt_any_key($prompt)
#pod
#pod my $input = prompt_any_key($prompt);
#pod
#pod This routine prompts the user to "press any key to continue." C<$prompt>, if
#pod supplied, is the text to prompt with.
#pod
#pod =cut
sub prompt_any_key {
my ($plugin, $cmd, $prompt) = @_;
$prompt ||= "press any key to continue";
print $prompt;
Term::ReadKey::ReadMode 'cbreak';
Term::ReadKey::ReadKey(0);
Term::ReadKey::ReadMode 'normal';
print "\n";
}
lib/App/Cmd/Plugin/Prompt.pm view on Meta::CPAN
=encoding UTF-8
=head1 NAME
App::Cmd::Plugin::Prompt - plug prompting routines into your commands
=head1 VERSION
version 1.006
lib/App/Cmd/Plugin/Prompt.pm view on Meta::CPAN
use MyApp -command;
sub run {
my ($self, $opt, $args) = @_;
return unless prompt_yn('really do stuff?', { default => 1 });
...
}
=head1 PERL VERSION
lib/App/Cmd/Plugin/Prompt.pm view on Meta::CPAN
for any reason, and there is no promise that patches will be accepted to lower
the minimum required perl.
=head1 SUBROUTINES
=head2 prompt_str
my $input = prompt_str($prompt, \%opt)
This prompts a user for string input. It can be directed to
persist until input is 'acceptable'.
Valid options are:
=over 4
lib/App/Cmd/Plugin/Prompt.pm view on Meta::CPAN
user's response; default is to read from STDIN.
=item *
B<output:> optional coderef, which, when invoked (with two
arguments: the prompt and the choices/default), should
prompt the user; default is to write to STDOUT.
=item *
B<valid:> an optional coderef which any input is passed into
and which must return true in order for the program to
lib/App/Cmd/Plugin/Prompt.pm view on Meta::CPAN
B<default:> may be any string; must pass the 'valid' coderef
(if given)
=item *
B<choices:> what to display after the prompt; default is
either the 'default' parameter or nothing
=item *
B<no_valid_default:> do not test the 'default' parameter
lib/App/Cmd/Plugin/Prompt.pm view on Meta::CPAN
'default' parameter is not valid (does not pass the 'valid'
coderef)
=back
=head2 prompt_yn
my $bool = prompt_yn($prompt, \%opt);
This prompts the user for a yes or no response and won't give up until it gets
one. It returns true for yes and false for no.
Valid options are:
default: may be yes or no, indicating how to interpret an empty response;
if empty, require an explicit answer; defaults to empty
=head2 prompt_any_key($prompt)
my $input = prompt_any_key($prompt);
This routine prompts the user to "press any key to continue." C<$prompt>, if
supplied, is the text to prompt with.
=head1 SEE ALSO
L<App::Cmd>
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/AutoInstall.pm view on Meta::CPAN
$AllDeps = 1;
}
}
}
# overrides MakeMaker's prompt() to automatically accept the default choice
sub _prompt {
goto &ExtUtils::MakeMaker::prompt unless $AcceptDefault;
my ( $prompt, $default ) = @_;
my $y = ( $default =~ /^[Yy]/ );
print $prompt, ' [', ( $y ? 'Y' : 'y' ), '/', ( $y ? 'n' : 'N' ), '] ';
print "$default\n";
return $default;
}
# the workhorse
inc/Module/AutoInstall.pm view on Meta::CPAN
map { +{@args}->{$_} }
grep { /^[^\-]/ or /^-core$/i } keys %{ +{@args} }
)[0]
);
# We want to know if we're under CPAN early to avoid prompting, but
# if we aren't going to try and install anything anyway then skip the
# check entirely since we don't want to have to load (and configure)
# an old CPAN just for a cosmetic message
$UnderCPAN = _check_lock(1) unless $SkipInstall || $InstallDepsTarget;
inc/Module/AutoInstall.pm view on Meta::CPAN
and (
$CheckOnly
or ($mandatory and $UnderCPAN)
or $AllDeps
or $InstallDepsTarget
or _prompt(
qq{==> Auto-install the }
. ( @required / 2 )
. ( $mandatory ? ' mandatory' : ' optional' )
. qq{ module(s) from CPAN?},
$default ? 'y' : 'n',
inc/Module/AutoInstall.pm view on Meta::CPAN
elsif ( !$SkipInstall
and $default
and $mandatory
and
_prompt( qq{==> The module(s) are mandatory! Really skip?}, 'n', )
=~ /^[Nn]/ )
{
push( @Missing, @required );
$DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
}
inc/Module/AutoInstall.pm view on Meta::CPAN
return
if _version_cmp( _version_of($class), $ver ) >= 0; # no need to upgrade
if (
_prompt( "==> A newer version of $class ($ver) is required. Install?",
'y' ) =~ /^[Nn]/
)
{
die "*** Please install $class $ver manually.\n";
}
inc/Module/AutoInstall.pm view on Meta::CPAN
# check if we're connected to some host, using inet_aton
sub _connected_to {
my $site = shift;
return (
( _load('Socket') and Socket::inet_aton($site) ) or _prompt(
qq(
*** Your host cannot resolve the domain name '$site', which
probably means the Internet connections are unavailable.
==> Should we try to install the required module(s) anyway?), 'n'
) =~ /^[Yy]/
inc/Module/AutoInstall.pm view on Meta::CPAN
*** You are not allowed to write to the directory '$path';
the installation may fail due to insufficient permissions.
.
if (
eval '$>' and lc(`sudo -V`) =~ /version/ and _prompt(
qq(
==> Should we try to re-execute the autoinstall process with 'sudo'?),
((-t STDIN) ? 'y' : 'n')
) =~ /^[Yy]/
)
inc/Module/AutoInstall.pm view on Meta::CPAN
print << ".";
*** The 'sudo' command exited with error! Resuming...
.
}
return _prompt(
qq(
==> Should we try to install the required module(s) anyway?), 'n'
) =~ /^[Yy]/;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/CmdDispatch.pm view on Meta::CPAN
sub shell
{
my ( $self ) = @_;
$self->_print( "Enter a command or 'quit' to exit:\n" );
while ( my $line = $self->_prompt( '> ' ) )
{
chomp $line;
next unless $line =~ /\S/;
last if $line eq 'quit';
$self->run( split /\s+/, $line );
lib/App/CmdDispatch.pm view on Meta::CPAN
{
my $self = shift;
return $self->{io}->print( @_ );
}
sub _prompt
{
my $self = shift;
return $self->{io}->prompt( @_ );
}
sub _initialize_config
{
my ( $self, $config_file ) = @_;
lib/App/CmdDispatch.pm view on Meta::CPAN
sub _is_valid_io_object
{
my ( $io ) = @_;
return unless ref $io;
return 2 == grep { $io->can( $_ ) } qw/print prompt/;
}
sub _setup_commands
{
my ( $self, $commands ) = @_;
lib/App/CmdDispatch.pm view on Meta::CPAN
=back
=item io
An object supplying input and output services for the CmdDispatcher. This
object must provide both a C<print> method and a C<prompt> method. See
L<App::CmdDispatch::IO> for more information on the interface.
=item help:*
The options beginning with the string 'help:' are described in the docs for
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Cme/Common.pm view on Meta::CPAN
sub run_shell_ui ($self, $term_class, $inst) {
my $shell_ui = $term_class->new (
root => $inst->config_root,
title => $inst->application . ' configuration',
prompt => ' >',
);
# engage in user interaction
$shell_ui->run_loop;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/ConMenu.pm view on Meta::CPAN
choices then select one of those by pressing the corresponding number. This will cause ComMenu
to execute the associated commands in the menu.yml file.
The C<m.pl> in the scripts dir is a script that creates a menu by using the module. By default
the script uses ~/.con_menu.yml on unix type systems and <HOMEDIR>\_con_menu.yml on Windows type systems. If
the files do not exist then you will be prompted to create an example version.
=head1 LICENSE
Copyright (C) Michael Mueller.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/installguide.pod view on Meta::CPAN
on the App CVS repository but you do want to stay up to date with the
latest App software (recommended, because there are no releases yet).
cd $PREFIX/src
cvs -d :pserver:anonymous@cvs.perl.org:/cvs/public login
[press enter at the password prompt]
cvs -d :pserver:anonymous@cvs.perl.org:/cvs/public co p5ee
Later, when you want to refresh your directory with the latest software
from CVS, you can repeat the same commands or you can do the following.
view all matches for this distribution
view release on metacpan or search on metacpan
perlcritic.rc view on Meta::CPAN
# Write `open my $fh, q{<}, $filename;' instead of `open FH, q{<}, $filename;'.
[InputOutput::ProhibitBarewordFileHandles]
severity = 2
# Use "<>" or "<ARGV>" or a prompting module instead of "<STDIN>".
[InputOutput::ProhibitExplicitStdin]
# Use prompt() instead of -t.
[InputOutput::ProhibitInteractiveTest]
# Use `local $/ = undef' or File::Slurp instead of joined readline.
[InputOutput::ProhibitJoinedReadline]
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/CreateRandomFile.pm view on Meta::CPAN
summary => 'Whether or not the program should be interactive',
schema => 'bool',
default => 0,
description => <<'_',
If set to false then will not prompt interactively and usually will proceed
(unless for dangerous stuffs, in which case will bail immediately.
_
},
overwrite => {
lib/App/CreateRandomFile.pm view on Meta::CPAN
schema => 'bool',
default => 0,
description => <<'_',
If se to true then will overwrite existing file without warning. The default is
to prompt, or bail (if not interactive).
_
},
random_bytes => {
schema => ['bool', is=>1],
lib/App/CreateRandomFile.pm view on Meta::CPAN
=item * B<interactive> => I<bool> (default: 0)
Whether or not the program should be interactive.
If set to false then will not prompt interactively and usually will proceed
(unless for dangerous stuffs, in which case will bail immediately.
=item * B<name>* => I<str>
(No description)
lib/App/CreateRandomFile.pm view on Meta::CPAN
=item * B<overwrite> => I<bool> (default: 0)
Whether to overwrite existing file.
If se to true then will overwrite existing file without warning. The default is
to prompt, or bail (if not interactive).
=item * B<patterns> => I<array[str]>
(No description)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/CreateSparseFile.pm view on Meta::CPAN
summary => 'Whether or not the program should be interactive',
schema => 'bool',
default => 1,
description => <<'_',
If set to false then will not prompt interactively and usually will proceed
(unless for dangerous stuffs, in which case will bail immediately.
_
},
overwrite => {
lib/App/CreateSparseFile.pm view on Meta::CPAN
schema => 'bool',
default => 0,
description => <<'_',
If se to true then will overwrite existing file without warning. The default is
to prompt, or bail (if not interactive).
_
},
},
examples => [
lib/App/CreateSparseFile.pm view on Meta::CPAN
=item * B<interactive> => I<bool> (default: 1)
Whether or not the program should be interactive.
If set to false then will not prompt interactively and usually will proceed
(unless for dangerous stuffs, in which case will bail immediately.
=item * B<name>* => I<str>
=item * B<overwrite> => I<bool> (default: 0)
Whether to overwrite existing file.
If se to true then will overwrite existing file without warning. The default is
to prompt, or bail (if not interactive).
=item * B<size>* => I<str>
Size (e.g. 10K, 22.5M).
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Critique/Command/collect.pm view on Meta::CPAN
while ( @$all ) {
if ( $PAUSE_PROCESSING ) {
warning('[processing paused]');
PROMPT:
my $continue = prompt_str(
'>> (r)esume (h)alt (a)bort | (s)tatus ',
{
valid => sub { $_[0] =~ m/[rhas]{1}/ },
default => 'r',
}
view all matches for this distribution