App-padconsole
view release on metacpan or search on metacpan
if (-f $history_file) {
open my $hist, '<', $history_file or die "Unable to open $history_file: $!";
while (defined(my $line = <$hist>)) {
chomp $line;
_addtohistory($line);
$term->addhistory($line);
}
close $hist;
}
my $prompt = $alias.' $ ';
# For autocomplete
my @words = qw(exit help count
list search delete
text text_to_file html
html_to_file revcount authors
infos writeconf use
alist current open);
my @commands;
while (defined($_ = $term->readline($prompt))) {
chomp;
@commands = split(' ', $_);
my $command = shift @commands || '';
_addtohistory($_) unless ($command eq 'exit');
if ($command eq 'exit') {
_exit();
} elsif ($command eq 'help') {
_help();
} elsif ($command eq 'count') {
$args{user} = $user;
$args{password} = $passwd;
}
$ec = Etherpad->new(\%args);
if (!$ec->check_token()) {
print STDERR 'ERROR: Unable to bind with the etherpad instance.', "\n";
exit 5;
}
$prompt = $alias.' $ ';
} else {
print 'ERROR: Bad instance alias. Unable to get configuration for instance alias ', $alias, "\n";
}
} else {
print 'ERROR: no alias given!', "\n";
}
}
sub _writeconf {
$c->{instances} = \%instances;
( run in 0.611 second using v1.01-cache-2.11-cpan-0b5f733616e )