App-Siesh
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
# Note: this file was auto-generated by Module::Build::Compat version 0.3800
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";
}
require Cwd;
require File::Spec;
require CPAN;
Specifies the machine to connect to. Defaults to "imap".
port
Specifies the remote port to connect to. Defaults to 2000.
tls Specifies whether TLS is required ("require"), optional ("auto") or
disables ("off"). Defaults to *auto*.
file
If an IO::Handle object is provdided, App::Siesh won't read commands
from the command line prompt, but from that filehandle.
password
Specifies the password to login.
COMMANDS
list
Prints a list of all scripts on the server. The currently active
script, if any, is marked by a *** (astersik).
Synonyms: ls, dir
Synonyms: rm
edit *script-name*
Edits a script on the server without downloading it explicitly to
your disk first. Under the hood it creates a temporary file, puts
the script content in it and calls $ENV{EDITOR} on it. After that
the script is uploaded back. It's also possible to create and edit a
new script with this command.
If your script is syntactical incorrect, you will be prompted to
re-edit the file or throw away your changes.
Synonyms: vi
copy *script-name* *script-name*
Copies the contents of the source script-name to a target script.
The contents of the target script are overridden.
Synonyms: cp
) or pod2usage( -verbose => 0);
pod2usage( -verbose => 0, -exitval => 0 ) if $commandline{'help'};
pod2usage( -verbose => 2, -exitval => 0 ) if $commandline{'man'};
%configfile = %{ App::Siesh->read_config($commandline{'config'}) };
%config = ( %configfile, %commandline );
if(!$config{password}) {
$config{password} = prompt( "Password: ", -e => '*' );
}
if ( !is_interactive(*STDIN) ) {
$config{file} = IO::Handle->new_from_fd( *STDIN, 'r' );
}
elsif ( $config{command} and not $config{file} ) {
my $fh = IO::File->new_tmpfile();
for my $command ( @{ $config{command} } ) {
print {$fh} $command . "\n";
Specifies whether TLS is required ("require"), optional
("auto"), or disabled ("off"). Defaults to "auto".
=item B<--password> PASSWORD
Specifies the password to login.
=item B<--file> FILE
The commands in FILE are executed as they were entered on the shell
prompt. This options is ignored when batch commands are provided on
STDIN.
=item B<--command> COMMAND
COMMAND is a acceptable command as entered on the shell prompt. This
option maybe provided more than once. It it ignored if batch commands
are passed in via --file or STDIN.
=item B<--config> FILE
If specified, configuration options are read from this file instead
of that returned by L<Config::Find>.
=item B<--help>
lib/App/Siesh.pm view on Meta::CPAN
$sieve->auth( $config{user}, $config{password} ) or die "$@\n";
my %shellui_params;
if ($config{file}) {
$shellui_params{term} = App::Siesh::Batch->new($config{file});
}
my $term = new Term::ShellUI(
%shellui_params,
history_file => '~/.siesh_history',
prompt => 'siesh> ',
commands => {
"help" => {
desc => "Print this help page.",
args => sub { shift->help_args( undef, @_ ); },
method => sub { shift->help_call( undef, @_ ); },
},
"put" => {
desc => 'Upload a script onto the server.',
maxargs => 2,
minargs => 2,
lib/App/Siesh.pm view on Meta::CPAN
Specifies the remote port to connect to. Defaults to C<2000>.
=item tls
Specifies whether TLS is required ("require"), optional
("auto") or disables ("off"). Defaults to I<auto>.
=item file
If an IO::Handle object is provdided, App::Siesh won't read commands
from the command line prompt, but from that filehandle.
=item password
Specifies the password to login.
=back
=head1 COMMANDS
=over 4
lib/App/Siesh.pm view on Meta::CPAN
Synonyms: B<rm>
=item B<edit> I<script-name>
Edits a script on the server without downloading it explicitly to your
disk first. Under the hood it creates a temporary file, puts the script
content in it and calls C<$ENV{EDITOR}> on it. After that the script is
uploaded back. It's also possible to create and edit a new script with
this command.
If your script is syntactical incorrect, you will be prompted to
re-edit the file or throw away your changes.
Synonyms: B<vi>
=item B<copy> I<script-name> I<script-name>
Copies the contents of the source script-name to a target script.
The contents of the target script are overridden.
Synonyms: B<cp>
lib/Net/ManageSieve/Siesh.pm view on Meta::CPAN
sub edit_script {
my ( $sieve, $script ) = @_;
my ( $fh, $filename ) = $sieve->temp_scriptfile( $script, 1 );
my $editor = $ENV{'VISUAL'} || $ENV{'EDITOR'} || "vi";
while (1) {
system( $editor, $filename );
eval { $sieve->putfile( $filename, $script ); 1; } or do {
print "$@\n";
## There was maybe a parse error, if the user enters yes
## we reedit the file, otherwise we leave it by the next last
next if prompt( "Re-edit script? ", -yn );
};
## There was either no error with putfile or the user entered no
last;
}
return close $fh;
}
sub activate {
my ( $self, $script ) = @_;
return $self->setactive($script);
( run in 1.144 second using v1.01-cache-2.11-cpan-6aa56a78535 )