[Rt-commit] rt branch, 4.2/load-object-in-scalar-context, created. rt-4.1.6-280-g8ededdc
? sunnavy
sunnavy at bestpractical.com
Tue Feb 26 10:31:38 EST 2013
The branch, 4.2/load-object-in-scalar-context has been created
at 8ededdc93c484ab2275a35a5c93ab3d66372518b (commit)
- Log -----------------------------------------------------------------
commit 8ededdc93c484ab2275a35a5c93ab3d66372518b
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Feb 26 23:24:03 2013 +0800
return status only in scalar context is more useful
otherwise, it always returns useless 2 in scalar context.
now we can easily check if ->Load succeeded or not, for example,
$principal->Load(...) or Abort(...)
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 1942e7e..82ac7db 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -393,7 +393,10 @@ sub LoadByCols {
# We don't want to hang onto this
$self->ClearAttributes;
- return $self->SUPER::LoadByCols( @_ ) unless $self->_Handle->CaseSensitive;
+ unless ( $self->_Handle->CaseSensitive ) {
+ my ( $ret, $msg ) = $self->SUPER::LoadByCols( @_ );
+ return wantarray ? ( $ret, $msg ) : $ret;
+ }
# If this database is case sensitive we need to uncase objects for
# explicit loading
@@ -411,7 +414,8 @@ sub LoadByCols {
$hash{$key}->{function} = $func;
}
}
- return $self->SUPER::LoadByCols( %hash );
+ my ( $ret, $msg ) = $self->SUPER::LoadByCols( %hash );
+ return wantarray ? ( $ret, $msg ) : $ret;
}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list