X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRelationship%2FManyToMany.pm;h=2812b6bf0c1debb906cc52b6ad2a7eb0ddca4cf2;hb=f4dc39d649672ff4452cf827ca204a1e937bc8b7;hp=fdd46972ca1d0f6f5320a6c14a822ddc966ba637;hpb=1b822bd3e15476666e97d9a95754f123410b3c56;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Relationship/ManyToMany.pm b/lib/DBIx/Class/Relationship/ManyToMany.pm index fdd4697..2812b6b 100644 --- a/lib/DBIx/Class/Relationship/ManyToMany.pm +++ b/lib/DBIx/Class/Relationship/ManyToMany.pm @@ -7,9 +7,10 @@ use warnings; use DBIx::Class::Carp; use DBIx::Class::_Util qw( quote_sub perlstring ); -# FIXME - this souldn't be needed -my $cu; -BEGIN { $cu = \&carp_unique } +# FIXME - this should go away +# instead Carp::Skip should export usable keywords or something like that +my $unique_carper; +BEGIN { $unique_carper = \&carp_unique } use namespace::clean; @@ -60,6 +61,10 @@ EOW {}, { attributes => [ 'DBIC_method_is_indirect_sugar', + ( keys( %{$rel_attrs||{}} ) + ? 'DBIC_method_is_m2m_sugar_with_attrs' + : 'DBIC_method_is_m2m_sugar' + ), ] }, ); @@ -78,10 +83,14 @@ EOC my @extra_meth_qsub_args = ( { '$rel_attrs' => \{ alias => $f_rel, %{ $rel_attrs||{} } }, - '$carp_unique' => \$cu, + '$carp_unique' => \$unique_carper, }, { attributes => [ 'DBIC_method_is_indirect_sugar', + ( keys( %{$rel_attrs||{}} ) + ? 'DBIC_method_is_m2m_extra_sugar_with_attrs' + : 'DBIC_method_is_m2m_extra_sugar' + ), ] }, ); @@ -206,6 +215,11 @@ EOC $guard->commit if $guard; EOC + + # the last method needs no captures - just kill it all with fire + $extra_meth_qsub_args[0] = {}; + + quote_sub "${class}::${remove_meth}", sprintf( <<'EOC', $remove_meth, $rel, $f_rel ), @extra_meth_qsub_args; $_[0]->throw_exception("'%1$s' expects an object")