about summary refs log tree commit homepage
path: root/script/public-inbox-convert
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-05-17 19:48:14 +0000
committerEric Wong <e@yhbt.net>2020-05-19 07:42:48 +0000
commit7bca96023bb26438a5c9d0a7eec3986f5d66f5bf (patch)
tree4b92cc3c85faad6986a80b122bb41072a583397a /script/public-inbox-convert
parentc43813b9138398ed2de06c3616a5932725090ae3 (diff)
downloadpublic-inbox-7bca96023bb26438a5c9d0a7eec3986f5d66f5bf.tar.gz
In our inbox-writing code paths, ->getline as an OO method may
be confused with the various definitions of `getline' used by
the PSGI interface.  It's also easier to do: "perldoc -f readline"
than to figure out which class "->getline" belongs to (IO::Handle)
and lookup documentation for that.

->print is less confusing than the "readline" vs "getline"
mismatch, but we can still make it clear we're using a real
file handle and not a mock interface.

Finally, functions are a bit faster than their OO counterparts.
Diffstat (limited to 'script/public-inbox-convert')
-rwxr-xr-xscript/public-inbox-convert14
1 files changed, 7 insertions, 7 deletions
diff --git a/script/public-inbox-convert b/script/public-inbox-convert
index 4c220b36..7fb15adf 100755
--- a/script/public-inbox-convert
+++ b/script/public-inbox-convert
@@ -111,12 +111,12 @@ while (<$rd>) {
                 $state = 'commit';
         } elsif (/^data ([0-9]+)/) {
                 my $len = $1;
-                $w->print($_) or $im->wfail;
+                print $w $_ or $im->wfail;
                 while ($len) {
                         my $n = read($rd, my $tmp, $len) or die "read: $!";
                         warn "$n != $len\n" if $n != $len;
                         $len -= $n;
-                        $w->print($tmp) or $im->wfail;
+                        print $w $tmp or $im->wfail;
                 }
                 next;
         } elsif ($state eq 'commit') {
@@ -124,9 +124,9 @@ while (<$rd>) {
                         my ($mark, $path) = ($1, $2);
                         $D{$path} = $mark;
                         if ($last && $last ne 'm') {
-                                $w->print("D $last\n") or $im->wfail;
+                                print $w "D $last\n" or $im->wfail;
                         }
-                        $w->print("M 100644 :$mark m\n") or $im->wfail;
+                        print $w "M 100644 :$mark m\n" or $im->wfail;
                         $last = 'm';
                         next;
                 }
@@ -134,15 +134,15 @@ while (<$rd>) {
                         my $mark = delete $D{$1};
                         defined $mark or die "undeleted path: $1\n";
                         if ($last && $last ne 'd') {
-                                $w->print("D $last\n") or $im->wfail;
+                                print $w "D $last\n" or $im->wfail;
                         }
-                        $w->print("M 100644 :$mark d\n") or $im->wfail;
+                        print $w "M 100644 :$mark d\n" or $im->wfail;
                         $last = 'd';
                         next;
                 }
         }
         last if $_ eq "done\n";
-        $w->print($_) or $im->wfail;
+        print $w $_ or $im->wfail;
 }
 $w = $r = undef;
 close $rd or die "close fast-export: $!\n";