}
elsif ($acc_type eq 'multi') {
- quote_sub "${class}::${rel}_rs", "shift->related_resultset( q{$rel} )->search_rs( \@_ )";
- quote_sub "${class}::add_to_${rel}", "shift->create_related( q{$rel} => \@_ )";
+ quote_sub "${class}::${rel}_rs", sprintf( <<'EOC', perlstring $rel );
+ DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_INDIRECT_CALLS and DBIx::Class::_Util::fail_on_internal_call;
+ shift->related_resultset(%s)->search_rs( @_ )
+EOC
+
+ quote_sub "${class}::add_to_${rel}", sprintf( <<'EOC', perlstring $rel );
+ DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_INDIRECT_CALLS and DBIx::Class::_Util::fail_on_internal_call;
+ shift->create_related( %s => @_ );
+EOC
+
quote_sub "${class}::${rel}", sprintf( <<'EOC', perlstring $rel );
+ DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_INDIRECT_CALLS and DBIx::Class::_Util::fail_on_internal_call;
DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_WANTARRAY and my $sog = DBIx::Class::_Util::fail_on_internal_wantarray;
shift->related_resultset(%s)->search( @_ )
EOC
use warnings;
use DBIx::Class::Carp;
-use DBIx::Class::_Util qw(fail_on_internal_wantarray quote_sub);
+use DBIx::Class::_Util qw( quote_sub perlstring );
# FIXME - this souldn't be needed
my $cu;
'$carp_unique' => \$cu,
};
- quote_sub "${class}::${rs_meth}", sprintf( <<'EOC', $rel, $f_rel ), $qsub_attrs;
+ quote_sub "${class}::${rs_meth}", sprintf( <<'EOC', map { perlstring $_ } ( "${class}::${meth}", $rel, $f_rel ) ), $qsub_attrs;
+
+ DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_INDIRECT_CALLS
+ and
+ # allow nested calls from our ->many_to_many, see comment below
+ ( (CORE::caller(1))[3] ne %s )
+ and
+ DBIx::Class::_Util::fail_on_internal_call;
# this little horror is there replicating a deprecation from
# within search_rs() itself
- shift->related_resultset( q{%1$s} )
- ->related_resultset( q{%2$s} )
+ shift->related_resultset( %s )
+ ->related_resultset( %s )
->search_rs (
undef,
( @_ > 1 and ref $_[-1] eq 'HASH' )
quote_sub "${class}::${meth}", sprintf( <<'EOC', $rs_meth );
+ DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_INDIRECT_CALLS and DBIx::Class::_Util::fail_on_internal_call;
DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_WANTARRAY and my $sog = DBIx::Class::_Util::fail_on_internal_wantarray;
my $rs = shift->%s( @_ );
return $self;
}
-sub add_column { shift->add_columns(@_); } # DO NOT CHANGE THIS TO GLOB
+sub add_column {
+ DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_INDIRECT_CALLS and fail_on_internal_call;
+ shift->add_columns(@_)
+}
=head2 has_column
$self->_ordered_columns([ grep { not $to_remove{$_} } @{$self->_ordered_columns} ]);
}
-# DO NOT CHANGE THIS TO A GLOB
sub remove_column {
DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_INDIRECT_CALLS and fail_on_internal_call;
shift->remove_columns(@_)
}
}
+ # Legacy stuff, not inserting INDIRECT assertions
quote_sub "${target}::${_}" => "shift->schema->$_(\@_)"
for qw(class source resultset);
}