Author: jamessan
Date: 2010-01-11 02:26:39 +0000 (Mon, 11 Jan 2010)
New Revision: 2078

Modified:
   trunk/debian/changelog
   trunk/scripts/chdist.pl
Log:
chdist: Add "use strict" and update for compliance.

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2010-01-09 02:30:09 UTC (rev 2077)
+++ trunk/debian/changelog      2010-01-11 02:26:39 UTC (rev 2078)
@@ -13,6 +13,7 @@
       known madison URL.
     + Detect an existing '?' in a URL and use '&' to append more cgi
       parameters.  Thanks to Raphael Geissert.
+  * chdist: Add "use strict" and update for compliance.
 
  -- James Vega <[email protected]>  Sat, 02 Jan 2010 22:30:26 -0500
 

Modified: trunk/scripts/chdist.pl
===================================================================
--- trunk/scripts/chdist.pl     2010-01-09 02:30:09 UTC (rev 2077)
+++ trunk/scripts/chdist.pl     2010-01-11 02:26:39 UTC (rev 2078)
@@ -99,10 +99,13 @@
 
 =cut
 
+use strict;
+use warnings;
+use File::Basename;
 use Getopt::Long qw(:config require_order);
 use Cwd qw(abs_path cwd);
 
-my $datadir = $ENV{'HOME'} . '/.chdist';
+my $progname = basename($0);
 
 sub usage {
   return <<EOF;
@@ -149,6 +152,9 @@
 License, version 2 or (at your option) any later version.
 EOF
 
+my $arch;
+my $datadir = $ENV{'HOME'} . '/.chdist';
+
 GetOptions(
   "help"       => \$help,
   "data-dir=s" => \$datadir,
@@ -290,7 +296,7 @@
   my ($dir) = @_;
   my @temp = split /\//, $dir;
   my $createdir = "";
-  foreach $piece (@temp) {
+  foreach my $piece (@temp) {
      $createdir .= "/$piece";
      if (! -d $createdir) {
         mkdir($createdir);
@@ -311,7 +317,7 @@
     mkdir($datadir);
   }
   mkdir($dir);
-  foreach $d (('/etc/apt', '/var/lib/apt/lists/partial', '/var/lib/dpkg', 
'/var/cache/apt/archives/partial')) {
+  foreach my $d (('/etc/apt', '/var/lib/apt/lists/partial', '/var/lib/dpkg', 
'/var/cache/apt/archives/partial')) {
      recurs_mkdir("$dir/$d");
   }
 
@@ -387,7 +393,7 @@
   # Takes a list of dists, a type of comparison and a do_compare flag
   my ($dists, $do_compare, $type) = @_;
   # Type is 'Sources' by default
-  $type ||= Sources;
+  $type ||= 'Sources';
   type_check($type);
 
   $do_compare = 0 if $do_compare eq 'false';
@@ -572,16 +578,16 @@
 
 sub grep_file {
   my (@argv, $file) = @_;
-  $dist = shift @argv;
+  my $dist = shift @argv;
   dist_check($dist);
-  $f = glob($datadir . '/' . $dist . "/var/lib/apt/lists/*_$file");
+  my $f = glob($datadir . '/' . $dist . "/var/lib/apt/lists/*_$file");
   # FIXME avoid shell invoc, potential quoting problems here
   system("cat $f | grep-dctrl @argv");
 }
 
 sub list {
   opendir(DIR, $datadir) or die "can't open dir $datadir: $!";
-  while (defined($file = readdir(DIR))) {
+  while (my $file = readdir(DIR)) {
      if ( (-d "$datadir/$file") && ($file =~ m|^\w+|) ) {
         print "$file\n";
      }



-- 
To unsubscribe, send mail to [email protected].

Reply via email to