[lintian] 03/13: c/spellintian: Replace Monkey::Patch with new Lintian API
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository lintian.
commit f143d2121c4ee3bcbf531d4336b84c8346908ccb
Author: Niels Thykier <niels@thykier.net>
Date: Fri Jun 19 22:49:35 2015 +0200
c/spellintian: Replace Monkey::Patch with new Lintian API
Signed-off-by: Niels Thykier <niels@thykier.net>
---
commands/spellintian.pm | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/commands/spellintian.pm b/commands/spellintian.pm
index 8448e88..58f6370 100644
--- a/commands/spellintian.pm
+++ b/commands/spellintian.pm
@@ -26,9 +26,7 @@ use Getopt::Long ();
use Lintian::Profile ();
use Lintian::Data ();
-use Lintian::Check ();
-
-use Monkey::Patch ();
+use Lintian::Check qw(check_spelling check_spelling_picky);
our $VERSION = '0.0';
@@ -66,24 +64,17 @@ my $picky = 0;
) or exit(1);
}
-my $monkey = Monkey::Patch::patch_package 'Lintian::Check' => '_tag' => sub {
- my ($orig, $path, undef, $mistake, $correction) = @_;
- my $prefix = ref($path) ? '' : "$path: ";
- print "$prefix$mistake -> $correction\n";
-};
-
sub spellcheck
{
my ($path, $text) = @_;
- # Normalize whitespace as a work-around for
- # <https://bugs.debian.org/763456>:
- $text =~ s/\s+/ /g;
- if (not defined $path) {
- $path = \undef;
- }
- Lintian::Check::check_spelling($path, $text);
+ my $prefix = $path ? "$path: " : q{};
+ my $spelling_error_handler = sub {
+ my ($mistake, $correction) = @_;
+ print "$prefix$mistake -> $correction\n";
+ };
+ check_spelling($text, $spelling_error_handler);
if ($picky) {
- Lintian::Check::check_spelling_picky($path, $text);
+ check_spelling_picky($text, $spelling_error_handler);
}
return;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: