Another Moose Test Day



  • Why break a habit day here in the Moose-Pen

    Time for another bottom up test run and for Database::Accessor I had


    8 files changed, 317 insertions(+), 237 deletions(-)

    and all my tests passed so maybe a very short post today?

    Driver::DBI was changed about the same with


    7 files changed, 1056 insertions(+), 835 deletions(-)

    but this time round I got a full pass but I was plagued by warnings like these.

    Use of uninitialized value in array element at /home/scolesj/database-accessor-driver-dbi/lib/Database/Accessor/Driver/DBI.pm line 803.
    Use of uninitialized value in numeric ge (>=) at /home/scolesj/database-accessor-driver-dbi/lib/Database/Accessor/Driver/DBI.pm line 802.

    I guess a little longer post today.

    The code in question


    my @params = @{ $self->params() };
    if ($self->identity_index() >=0){

    was from what I tried to fix the other day. I did fix it for '22_fields_extended.t' test case but it is all the other ones that are now causing me grief.

    This one proved a little tricky to fix but in the end I got it. I had to borrow from the good old 'index' command where the '-1' result means not found as this is an internal value I think I can get away with that.

    First I had to change Database::Accessor a little first by adding in a default value of '1-' for the 'identity_index' attribute on the 'Database::Accessor::Roles::Driver' class;


    has identity_index => (
    is => 'ro',
    isa => 'Int',
    ++ default => -1,
    );

    and in the 'get_dad_elements' sub to account for that new '-1' value,

           my $self = shift;
            my ($action,$opt) = @_;
           
    --      $self->_identity_index(undef);
    ++      $self->_identity_index(-1);

                if ( ref($element) eq 'Database::Accessor::Element' and $element->identity() ){
    --              if ($self->_identity_index()){
    ++              if ($self->_identity_index() >=0 ){
                        die " Database::Accessor->"


    after a quick check-in and pull I am now getting;

    All tests successful.
    Files=11, Tests=462,

    Onto something new next week I guess.

    IMG_1639b.jpg



    http://blogs.perl.org/users/byterock/2018/09/another-moose-test-day.html

Log in to reply
 

© Lightnetics 2019