[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 05/13: spellintian: Do some minor style changes



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit 182f072eb197a39142e4521394bbf6e19b76cc53
Author: Niels Thykier <niels@thykier.net>
Date:   Fri Jun 19 23:03:45 2015 +0200

    spellintian: Do some minor style changes
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 commands/spellintian.pm | 41 +++++++++++++++--------------------------
 1 file changed, 15 insertions(+), 26 deletions(-)

diff --git a/commands/spellintian.pm b/commands/spellintian.pm
index 8f653dc..0972bc1 100644
--- a/commands/spellintian.pm
+++ b/commands/spellintian.pm
@@ -20,32 +20,30 @@
 
 use strict;
 use warnings;
+use autodie;
 
-use English qw(-no_match_vars);
-use Getopt::Long ();
+use Getopt::Long();
 
-use Lintian::Profile ();
-use Lintian::Data ();
 use Lintian::Check qw(check_spelling check_spelling_picky);
+use Lintian::Data;
+use Lintian::Profile;
+use Lintian::Util qw(slurp_entire_file);
 
 our $VERSION = '0.0';
 
-sub show_version
-{
+sub show_version {
     print "spellintian $VERSION\n";
     exit 0;
 }
 
-sub show_help
-{
+sub show_help {
     print <<'EOF' ;
 Usage: spellintian [--picky] [FILE...]
 EOF
     exit 0;
 }
 
-sub spellcheck
-{
+sub spellcheck {
     my ($path, $picky, $text) = @_;
     my $prefix = $path ? "$path: " : q{};
     my $spelling_error_handler = sub {
@@ -59,7 +57,6 @@ sub spellcheck
     return;
 }
 
-
 sub main {
     my $profile = Lintian::Profile->new;
     Lintian::Data->set_vendor($profile);
@@ -75,28 +72,20 @@ sub main {
         };
         Getopt::Long::Configure('gnu_getopt');
         Getopt::Long::GetOptions(
-            '--picky' => \$picky,
-            'h|help' => \&show_help,
+            'picky'   => \$picky,
+            'h|help'  => \&show_help,
             'version' => \&show_version,
         ) or exit(1);
     }
 
     if (not @ARGV) {
-        my $text;
-        {
-            local $RS = undef;
-            $text = <STDIN>;
-        }
+        my $text = slurp_entire_file(*STDIN);
         spellcheck(undef, $picky, $text);
     } else {
         for my $path (@ARGV) {
             my $text;
-            open(my $fh, '<', $path) or die $ERRNO;
-            {
-                local $RS = undef;
-                $text = <$fh>;
-            }
-            close($fh) or die $ERRNO;
+            die("$path is a directory\n") if not -f $path;
+            $text = slurp_entire_file($path);
             spellcheck($path, $picky, $text);
         }
     }
@@ -104,8 +93,8 @@ sub main {
 }
 
 END {
-    close(STDOUT) or die $ERRNO;
-    close(STDERR) or die $ERRNO;
+    close(STDOUT);
+    close(STDERR);
 }
 
 # Local Variables:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: