diff options
author | Russ Allbery <rra@stanford.edu> | 2007-12-05 01:34:39 +0000 |
---|---|---|
committer | Russ Allbery <rra@stanford.edu> | 2007-12-05 01:34:39 +0000 |
commit | 5ad61b6ecd14adffa013ef5b0b8c2b8da8cca03b (patch) | |
tree | fa3cc53424cb31c6d4306ca2ccb438e0e244806f /perl | |
parent | c74e1824fe878d6289a6a0fa3b777d5c425e0a44 (diff) |
Coding style improvements.
Diffstat (limited to 'perl')
-rw-r--r-- | perl/Wallet/Object/Base.pm | 8 | ||||
-rw-r--r-- | perl/Wallet/Object/Keytab.pm | 7 |
2 files changed, 5 insertions, 10 deletions
diff --git a/perl/Wallet/Object/Base.pm b/perl/Wallet/Object/Base.pm index bc9fc1e..ff6f008 100644 --- a/perl/Wallet/Object/Base.pm +++ b/perl/Wallet/Object/Base.pm @@ -23,7 +23,7 @@ use Wallet::ACL; # This version should be increased on any code change to this module. Always # use two digits for the minor version with a leading zero if necessary so # that it will sort properly. -$VERSION = '0.02'; +$VERSION = '0.03'; ############################################################################## # Constructors @@ -357,10 +357,8 @@ sub flag_check { $self->error ("cannot check flag $flag for ${type}:${name}: $@"); $dbh->rollback; return; - } elsif ($value) { - return 1; } else { - return 0; + return ($value) ? 1 : 0; } } @@ -573,7 +571,7 @@ sub show { # Format the results. We use a hack to insert the flags before the first # trace field since they're not a field in the object in their own right. - for (my $i = 0; $i < @data; $i++) { + for my $i (0 .. $#data) { if ($attrs[$i][0] eq 'ob_created_by') { my @flags = $self->flag_list; if (not @flags and $self->error) { diff --git a/perl/Wallet/Object/Keytab.pm b/perl/Wallet/Object/Keytab.pm index c2f66d4..7aeb5da 100644 --- a/perl/Wallet/Object/Keytab.pm +++ b/perl/Wallet/Object/Keytab.pm @@ -24,7 +24,7 @@ use Wallet::Object::Base; # This version should be increased on any code change to this module. Always # use two digits for the minor version with a leading zero if necessary so # that it will sort properly. -$VERSION = '0.02'; +$VERSION = '0.03'; ############################################################################## # kadmin Interaction @@ -36,10 +36,7 @@ $VERSION = '0.02'; # realm information here. sub valid_principal { my ($self, $principal) = @_; - if ($principal !~ m,^[\w-]+(/[\w_-]+)?\z,) { - return undef; - } - return 1; + return scalar ($principal =~ m,^[\w-]+(/[\w_-]+)?\z,); } # Run a kadmin command and capture the output. Returns the output, either as |