
Was already implicitly required (since 59387ddb
) because RevBank::Amount
uses the "isa" feature, which was introduced in Perl 5.32 (but no longer
experimental since 5.36, not 5.32 as the old comment said).
Perl 5.32 was released in June 2020, and ships with Debian bullseye
("oldstable") which was released in August 2021.
57 lines
1.1 KiB
Perl
57 lines
1.1 KiB
Perl
package RevBank::Plugin;
|
|
|
|
use v5.32;
|
|
use warnings;
|
|
use experimental 'signatures'; # stable since v5.36
|
|
use attributes;
|
|
|
|
require RevBank::Global;
|
|
|
|
sub new($class) {
|
|
return bless { }, $class;
|
|
}
|
|
|
|
sub command($self, $cart, $command, @) {
|
|
return RevBank::Global::NEXT();
|
|
}
|
|
|
|
sub Tab($self, $method) {
|
|
my %completions;
|
|
|
|
my $attr = attributes::get(
|
|
ref $method ? $method : $self->can($method)
|
|
) or return;
|
|
|
|
my ($tab) = $attr =~ /Tab \( (.*?) \)/x;
|
|
for my $keyword (split /\s*,\s*/, $tab) {
|
|
if ($keyword =~ /^&(.*)/) {
|
|
my $method = $1;
|
|
@completions{ $self->$method } = ();
|
|
} else {
|
|
$completions{ $keyword }++;
|
|
}
|
|
}
|
|
|
|
if (delete $completions{USERS}) {
|
|
for my $name (RevBank::Users::names()) {
|
|
next if RevBank::Users::is_hidden($name);
|
|
|
|
$completions{ $name }++;
|
|
$completions{ $1 }++ if $name =~ /^\*(.*)/;
|
|
}
|
|
}
|
|
|
|
return keys %completions;
|
|
}
|
|
|
|
1;
|
|
|
|
__END__
|
|
|
|
=head1 NAME
|
|
|
|
RevBank::Plugin - Base class for RevBank plugins
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
Documentation on writing plugins is at L<RevBank::Plugins>.
|