summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2014-07-30 21:31:28 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2014-07-30 21:31:28 (GMT)
commitd45c8b4133e882b3d37ef63930849d714a517010 (patch) (side-by-side diff)
tree786a5814a9a8fa81cf839a4859bdbe7431f81e3d
parent6c604cdf5bb45a6a3d58f1f2eb985622ed39248a (diff)
downloadgitaclhook-d45c8b4133e882b3d37ef63930849d714a517010.tar.gz
gitaclhook-d45c8b4133e882b3d37ef63930849d714a517010.tar.bz2
Minor imorivement
* lib/GitACL.pm: Use class attributes instead of state variables.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--lib/GitACL.pm23
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/GitACL.pm b/lib/GitACL.pm
index f7743d5..4c1cc67 100644
--- a/lib/GitACL.pm
+++ b/lib/GitACL.pm
@@ -19,3 +19,2 @@ package GitACL;
use strict;
-use feature "state";
use File::Spec;
@@ -168,18 +167,16 @@ sub match_tree($$) {
my ($self, $expr) = @_;
- state @tree;
- state $init;
- unless (defined($init)) {
+ unless (defined($self->{tree_init})) {
if (defined($self->{files})) {
- @tree = @{$self->{files}};
+ $self->{tree} = $self->{files};
} else {
- @tree = git_values("diff-tree",
- "--no-commit-id", "--name-only", "-r",
- $self->{new});
+ $self->{tree} = [git_values("diff-tree",
+ "--no-commit-id", "--name-only", "-r",
+ $self->{new})];
}
- $init = 1;
+ $self->{tree_init} = 1;
}
- for (my $i = 0; $i <= $#tree; ) {
- my $dir = $tree[$i];
+ for (my $i = 0; $i <= $#{$self->{tree}}; ) {
+ my $dir = $self->{tree}[$i];
@@ -189,3 +186,3 @@ sub match_tree($$) {
or $dir eq $expr) {
- splice(@tree, $i, 1);
+ splice(@{$self->{tree}}, $i, 1);
} else {
@@ -195,3 +192,3 @@ sub match_tree($$) {
- return $#tree == -1;
+ return $#{$self->{tree}} == -1;
}

Return to:

Send suggestions and report system problems to the System administrator.