summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6b3e21d)
raw | patch | inline | side by side (parent: 6b3e21d)
author | Ryan Anderson <ryan@michonline.com> | |
Sun, 26 Feb 2006 21:09:12 +0000 (16:09 -0500) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 26 Feb 2006 22:45:22 +0000 (14:45 -0800) |
Note: This needs someone to tell me what the value of $^O is on ActiveState.
Signed-off-by: Ryan Anderson <ryan@michonline.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Ryan Anderson <ryan@michonline.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-annotate.perl | patch | blob | history |
diff --git a/git-annotate.perl b/git-annotate.perl
index ee8ff1579285061ad13df206e74a2cd23e711d5a..f9c2c6caf5d2127d59cfd91d7bbecc2bc1466daf 100755 (executable)
--- a/git-annotate.perl
+++ b/git-annotate.perl
return join(' ', @field[0...(@field-4)]);
}
-
sub open_pipe {
+ if ($^O eq '##INSERT_ACTIVESTATE_STRING_HERE##') {
+ return open_pipe_activestate(@_);
+ } else {
+ return open_pipe_normal(@_);
+ }
+}
+
+sub open_pipe_activestate {
+ tie *fh, "Git::ActiveStatePipe", @_;
+ return *fh;
+}
+
+sub open_pipe_normal {
my (@execlist) = @_;
my $pid = open my $kid, "-|";
return $kid;
}
+
+package Git::ActiveStatePipe;
+use strict;
+
+sub TIEHANDLE {
+ my ($class, @params) = @_;
+ my $cmdline = join " ", @params;
+ my @data = qx{$cmdline};
+ bless { i => 0, data => \@data }, $class;
+}
+
+sub READLINE {
+ my $self = shift;
+ if ($self->{i} >= scalar @{$self->{data}}) {
+ return undef;
+ }
+ return $self->{'data'}->[ $self->{i}++ ];
+}
+
+sub CLOSE {
+ my $self = shift;
+ delete $self->{data};
+ delete $self->{i};
+}
+
+sub EOF {
+ my $self = shift;
+ return ($self->{i} >= scalar @{$self->{data}});
+}