allow arbitrary subs to be added to test cleanup
This commit is contained in:
parent
15939961bb
commit
eb97a8d50e
2 changed files with 6 additions and 5 deletions
|
|
@ -895,6 +895,9 @@ Example call:
|
|||
my $link = shift;
|
||||
$link->session->db->write("delete from ldapLink where ldapLinkId=?", [$link->{ldapLinkId}]);
|
||||
},
|
||||
'CODE' => sub {
|
||||
(shift)->();
|
||||
},
|
||||
);
|
||||
|
||||
sub cleanupGuard {
|
||||
|
|
@ -906,9 +909,9 @@ Example call:
|
|||
my $construct;
|
||||
if ( ref $class ) {
|
||||
my $object = $class;
|
||||
$class = ref $class;
|
||||
my $cloneSub = $CLASS->_findByIsa($class, \%clone);
|
||||
$construct = $cloneSub ? sub { $object->$cloneSub } : sub { $object };
|
||||
$class = ref $class;
|
||||
}
|
||||
else {
|
||||
my $id = shift;
|
||||
|
|
@ -958,7 +961,7 @@ sub _findByIsa {
|
|||
my $toFind = shift;
|
||||
my $hash = shift;
|
||||
for my $key ( sort { length $b <=> length $a} keys %$hash ) {
|
||||
if ($toFind->isa($key)) {
|
||||
if ($toFind eq $key || $toFind->isa($key)) {
|
||||
return $hash->{$key};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue