summaryrefslogtreecommitdiff
path: root/perl/Wallet/Server.pm
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2007-08-30 04:27:10 +0000
committerRuss Allbery <rra@stanford.edu>2007-08-30 04:27:10 +0000
commita0e3892a6e4865a36ac3848d640198dc3a25d6c1 (patch)
tree9dce0318522775a83595f4d3e9e61a5e062d006a /perl/Wallet/Server.pm
parent2e7b886b16e2e0adf723ac59efa715e15bb2e519 (diff)
Clean up all exception output when storing it in the error variable to
remove the " at line" stuff added by Perl and the newlines so that the errors stored in objects are consistent. Fix various bugs in the base object, including a few more type vs. name inversions and use of object instead of name. Allow owners to be specified as ACL names instead of IDs, and change the ID to a name in show. Add a new test suite for the base object implementation.
Diffstat (limited to 'perl/Wallet/Server.pm')
-rw-r--r--perl/Wallet/Server.pm16
1 files changed, 16 insertions, 0 deletions
diff --git a/perl/Wallet/Server.pm b/perl/Wallet/Server.pm
index dbf19bb..7c1443c 100644
--- a/perl/Wallet/Server.pm
+++ b/perl/Wallet/Server.pm
@@ -147,6 +147,8 @@ sub create {
my $object = eval { $class->create ($type, $name, $dbh, $user, $host) };
if ($@) {
$self->{error} = $@;
+ chomp $self->{error};
+ $self->{error} =~ / at .*$/;
return undef;
} else {
return $object;
@@ -165,6 +167,8 @@ sub retrieve {
my $object = eval { $class->new ($type, $name, $self->{dbh}) };
if ($@) {
$self->{error} = $@;
+ chomp $self->{error};
+ $self->{error} =~ / at .*$/;
return undef;
} else {
return $object;
@@ -204,6 +208,8 @@ sub acl_check {
my $acl = eval { Wallet::ACL->new ($id) };
if ($@) {
$self->{error} = $@;
+ chomp $self->{error};
+ $self->{error} =~ / at .*$/;
return undef;
}
my $status = $acl->check ($self->{user});
@@ -329,6 +335,8 @@ sub acl_create {
my $acl = eval { Wallet::ACL->create ($name, $dbh, $user, $host) };
if ($@) {
$self->{error} = $@;
+ chomp $self->{error};
+ $self->{error} =~ / at .*$/;
return undef;
} else {
return $acl;
@@ -359,6 +367,8 @@ sub acl_rename {
my $acl = { Wallet::ACL->new ($id, $self->{dbh}) };
if ($@) {
$self->{error} = $@;
+ chomp $self->{error};
+ $self->{error} =~ / at .*$/;
return undef;
}
unless ($acl->rename ($name)) {
@@ -379,6 +389,8 @@ sub acl_destroy {
my $acl = { Wallet::ACL->new ($id, $self->{dbh}) };
if ($@) {
$self->{error} = $@;
+ chomp $self->{error};
+ $self->{error} =~ / at .*$/;
return undef;
}
unless ($acl->destroy ($self->{user}, $self->{host})) {
@@ -399,6 +411,8 @@ sub acl_add {
my $acl = { Wallet::ACL->new ($id, $self->{dbh}) };
if ($@) {
$self->{error} = $@;
+ chomp $self->{error};
+ $self->{error} =~ / at .*$/;
return undef;
}
unless ($acl->add ($scheme, $identifier, $self->{user}, $self->{host})) {
@@ -419,6 +433,8 @@ sub acl_remove {
my $acl = { Wallet::ACL->new ($id, $self->{dbh}) };
if ($@) {
$self->{error} = $@;
+ chomp $self->{error};
+ $self->{error} =~ / at .*$/;
return undef;
}
my $user = $self->{user};