Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fails with unhelpful message when a sub and DBIx::Class relationship have the same name #38

Open
abraxxa opened this issue Aug 27, 2018 · 0 comments
Labels

Comments

@abraxxa
Copy link

abraxxa commented Aug 27, 2018

This code

package NAC::Model::DBIC::Table::Line;

use Moose;
use namespace::autoclean;

extends 'NAC::Model::DBIC::Table::Parent::All';

...

__PACKAGE__->many_to_many( 'affecting_maintenances' => 'rel_affected_by_maintenances' => 'rel_maintenance' );

sub affecting_maintenances {...}

in a DBIx::Class::Result class leads to the test failing with:

not ok 63 - lib/NAC/Model/DBIC/Table/Line.pm
    #   Failed test 'lib/NAC/Model/DBIC/Table/Line.pm'
    #   at t/release-unused-vars.t line 20.
    # checking NAC::Model::DBIC::Table::Line in NAC/Model/DBIC/Table/Line.pm ...
    # looking into &NAC::Model::DBIC::Table::Line::affecting_maintenances
    # $sog is used once in &NAC::Model::DBIC::Table::Line::affecting_maintenances 
    # $self is used 1 times
    # $rs is used 2 times

Grepping my local Perl 5.28.0 library brings up the following usages of $sog:

[~/perl5/perlbrew/perls/28.0$ (master)]$ grep -R '$sog'
lib/site_perl/5.28.0/DBIx/Class/Relationship/ManyToMany.pm:      DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_WANTARRAY and my $sog = fail_on_internal_wantarray;
lib/site_perl/5.28.0/DBIx/Class/Relationship/Accessor.pm:      DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_WANTARRAY and my $sog = DBIx::Class::_Util::fail_on_internal_wantarray;
lib/site_perl/5.28.0/DBIx/Class/ResultSetColumn.pm:    DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_WANTARRAY and my $sog = fail_on_internal_wantarray;
lib/site_perl/5.28.0/DBIx/Class/ResultSet.pm:    DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_WANTARRAY and my $sog = fail_on_internal_wantarray;
@jkeenan jkeenan added the Bug label Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants