2017-06-23 22 views
1

我們在過去的幾周內重新定位了我們的服務器,並且隨機(但是太頻繁地)發生了跟蹤錯誤。隨機看到「解決方法時發現存根」???「在「XXX」包中重載「」「」

dbix verison現在是0.082820,之前是0.08250,但未出現此錯誤。

「在解析方法中找到存根」???「overloading」「」「在包中」XXX「位於/home/perlbrew/.perlbrew/libs/[email protected]/lib/perl5/ DBIx/Class/Row.pm 1250行「。

包XXX

有這可能與

use Class::Trait qw(TPrintable ); 

sub inflate_result { 
    my $self = shift; 
    my $ret = $self->next::method(@_); 
    my $typeCd = $ret->typeCd; 
    given ($typeCd) { 
     when($specialTypeCd) { 
      $self->ensure_class_loaded($specialSubClass); 
      bless ($ret, $specialSubClass); 
     } 
     default { 
      bless ($ret, $self); 
     } 
    } 
    return $ret; 
} 

代碼引進包XXX有一個輔助方法做:

my $theY = $c->model('DB::Y')->find($yID, 
    { 
     prefetch => [ { 'xxxs' => 'typecd' } , 'zid' ] 
    }); 

return $theY; 

思考的問題是什麼;如何使其一致以提交錯誤報告。

我們已經知道在Abstract.pm 潛在的解決方法SQLA_ISVALUE_IGNORE_AUTOGENERATED_STRINGIFICATION = 1

+0

有在'SQL :: Abstract'中是[this comment](https://github.com/dbsrgits/sql-abstract/blob/ca4f826a37ccb5194b0b5b9b4190b4007d647d9c/lib/SQL/Abstract.pm#L100),但這並不意味着問題是在'SQL :: Abstract'中。 –

+2

另外,就我所見,CPAN上沒有版本「0.082820」。這再次強調了在升級生產庫之前進行廣泛測試的必要性。 –

+0

@SinanÜnür沒有注意到我們的0.082820不是最新的好產品。 (我正在讀它作爲當前最新的0.082840)感謝您花時間看。 – melutovich

回答

0

一個建議一個人誰修復選擇保持匿名 (這是不夠的,我們在我們的Perl 5.16.3)

我們結束了切換到perl 5.26,問題消失了。 (我們被告知:「你是不太可能:5.18大修大量超載內部的」)

diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm 
index 264b0b1..b4d8fb4 100644 
--- a/lib/SQL/Abstract.pm 
+++ b/lib/SQL/Abstract.pm 
@@ -104,7 +104,11 @@ sub is_plain_value ($) { 
     # "%s"> and the source of overload::mycan()) 
     # 
     # either has stringification which DBI SHOULD prefer out of the box 
-  grep { *{ (qq[${_}::(""]) }{CODE} } @{ $_[2] = mro::get_linear_isa($_[1]) } 
+  grep { 
+   *{ (qq[${_}::()]) }{CODE} 
+   and 
+   *{ (qq[${_}::(""]) }{CODE} 
+  } @{ $_[2] = mro::get_linear_isa($_[1]) } 
      or 
     # has nummification or boolification, AND fallback is *not* disabled 
     (

爲了把你放心:這裏是什麼是真正發生的事情:

perl -e ' 

    use warnings; 
    use strict; 

    require Scalar::Util; 

    { 
     package Some::Overload; 
     use overload 
     q{""}  => "named_stringifier", 
     fallback => 1, 
     ; 

     sub named_stringifier { $_[0] . "" } 
    } 

    { 
     package Some::Subclass; 
     use base "Some::Overload"; 
    } 


    my $thing = bless {}, "Some::Subclass"; 


    { 
     no strict "refs"; 
     grep { *{ (qq[${_}::(""]) }{CODE} } qw(Some::Subclass Some::Overload); 
    } 


    for (1, 2) { 


     # simulates runtime require of some *UNRELATED* class 
     eval sprintf <<EOS, $_; 
     { 
     package Some::UnrelatedThing%s; 
     use overload 
      q{""} => sub { \$_[0] . "" }, 
      fallback => 1, 
     ; 
     } 
EOS 

     my $some_object = bless {}, "Some::Subclass"; 
    } 

    warn "got here, all is well\n"; 
    exit 0; 
' 
相關問題