use DBIx::Class::Carp;
use DBIx::Class::ResultSetColumn;
use DBIx::Class::ResultClass::HashRefInflator;
-use Scalar::Util qw/blessed weaken reftype/;
+use Scalar::Util qw( blessed reftype );
use DBIx::Class::_Util qw(
dbic_internal_try dump_value
fail_on_internal_wantarray fail_on_internal_call UNRESOLVABLE_CONDITION
# if schema is still there reintroduce ourselves with strong refs back to us
if ($_[0]->{schema}) {
my $srcregs = $_[0]->{schema}->source_registrations;
- for (keys %$srcregs) {
- next unless $srcregs->{$_};
- $srcregs->{$_} = $_[0] if $srcregs->{$_} == $_[0];
- }
+
+ defined $srcregs->{$_}
+ and
+ $srcregs->{$_} == $_[0]
+ and
+ $srcregs->{$_} = $_[0]
+ and
+ last
+ for keys %$srcregs;
}
1;
#
# Deliberately *NOT* using is_exception - if someone left a misbehaving
# antipattern value in $@, it's not our business to whine about it
- if( defined $@ and length $@ ) {
- weaken(
- $guard->{existing_exception_ref} = (length ref $@) ? $@ : \$@
- );
- }
+ weaken(
+ $guard->{existing_exception_ref} = (length ref $@) ? $@ : \$@
+ ) if( defined $@ and length $@ );
$storage->txn_begin;
my $destruction_registry = {};
sub CLONE {
- $destruction_registry = { map
- { defined $_ ? ( refaddr($_) => $_ ) : () }
- values %$destruction_registry
- };
+ %$destruction_registry = map {
+ (defined $_)
+ ? ( refaddr($_) => $_ )
+ : ()
+ } values %$destruction_registry;
- weaken( $destruction_registry->{$_} )
- for keys %$destruction_registry;
+ weaken($_) for values %$destruction_registry;
# Dummy NEXTSTATE ensuring the all temporaries on the stack are garbage
# collected before leaving this scope. Depending on the code above, this
), 'with_stacktrace');
}
- my $mark = [];
- weaken ( $list_ctx_ok_stack_marker = $mark );
+ weaken( $list_ctx_ok_stack_marker = my $mark = [] );
+
$mark;
}
}