Subject: | Set::NestedGroups dies when membership of a non-existing group is tested |
Hi,
Let the patch speak for itself.
Cheers,
Anton.
--- t/basic.t.orig Tue Aug 31 16:12:51 2004
+++ t/basic.t Tue Aug 31 16:15:25 2004
@@ -6,7 +6,7 @@
# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)
-BEGIN { $| = 1; print "1..9\n"; }
+BEGIN { $| = 1; print "1..10\n"; }
END {print "not ok $loaded\n" unless $loaded;}
use Set::NestedGroups;
$loaded = 1;
@@ -70,4 +70,11 @@ if(@groups == 2 && join("",sort @groups)
print "ok 9\n";
} else {
print "not ok 9\n";
+}
+
+# version 0.01 died here
+unless($acl->member('schmuck','babushka')){
+ print "ok 10\n";
+} else {
+ print "not ok 10\n";
}
--- NestedGroups.pm.orig Sun Nov 1 04:04:48 1998
+++ NestedGroups.pm Tue Aug 31 16:11:54 2004
@@ -12,7 +12,7 @@ use Carp;
@EXPORT = qw(
);
-$VERSION = '0.01';
+$VERSION = '0.02';
# Constructor
sub new {
@@ -149,7 +149,7 @@ sub member {
return undef;
}
- return (keys %{$self->{'MEMBERS'}{$member}})
+ return (keys %{$self->{'MEMBERS'}{$member}||{}})
}
# Check a group
@@ -188,7 +188,7 @@ sub groups {
my $norecurse = $options{'-norecurse'} || 0;
my $nomiddles= $options{'-nomiddles'} || 0;
- my %group=%{$self->{'MEMBERS'}{$member}};
+ my %group=%{$self->{'MEMBERS'}{$member}||{}};
if(!$norecurse){
my $again = 1;