[Po4a-commits] r2344 - /trunk/Po4aBuilder.pm

barbier-guest at users.alioth.debian.org barbier-guest at users.alioth.debian.org
Sun Nov 21 11:30:11 UTC 2010


Author: barbier-guest
Date: Sun Nov 21 11:30:10 2010
New Revision: 2344

URL: http://svn.debian.org/wsvn/po4a/?sc=1&rev=2344
Log:
Use pure Perl to print POT file

Modified:
    trunk/Po4aBuilder.pm

Modified: trunk/Po4aBuilder.pm
URL: http://svn.debian.org/wsvn/po4a/trunk/Po4aBuilder.pm?rev=2344&op=diff
==============================================================================
--- trunk/Po4aBuilder.pm (original)
+++ trunk/Po4aBuilder.pm Sun Nov 21 11:30:10 2010
@@ -2,6 +2,7 @@
 use Module::Build;
 use File::Path;
 use File::Spec;
+use File::stat;
 
 @ISA = qw(Module::Build);
 
@@ -18,7 +19,7 @@
     my $dir = shift;
     my $files = $self->rscan_dir($dir, sub {-f});
     foreach my $file (@$files) {
-        my $current_mode = (stat $file)[2];
+        my $current_mode = stat($file)->mode;
         chmod $current_mode | oct(200), $file;
     }
 }
@@ -177,9 +178,11 @@
 
 sub postats {
     my ($self,$dir) = (shift,shift);
-    my $potsize = `(cd $dir;ls -sh *.pot) | sed -n -e 's/^ *\\([^[:blank:]]*\\).*\$/\\1/p'`;
-    $potsize =~ /(.*)/;
-    print "$dir (pot: $1)\n";
+    my $potfiles = $self->rscan_dir($dir,qr{\.pot$});
+    die "No POT file found in $dir" unless scalar $potfiles;
+    my $potfile = pop @$potfiles;
+    my $potsize = stat($potfile)->size;
+    print "$dir (pot: $potsize)\n";
     my @files = @{$self->rscan_dir($dir,qr{\.po$})};
     foreach (sort @files) {
         $file = $_;




More information about the Po4a-commits mailing list