[DBIx-Class-Devel] [dbsrgits/dbix-class] Treat undef like blessed objects for the purpose of looking for special handling (#106)

jonathancast notifications at github.com
Mon Jun 27 21:51:11 GMT 2016


Suppose `foo` is an inflated timestamp column and `$row->foo` is set to a true DateTime (representing a date, say, 2016-06-23T16:42:34).  In the present code, these two code snippets:

    $row->set_inflated_column(foo => undef);
    say 'The value is: '.$row->get_column('foo');
    say 'The value is: '.$row->foo;

    $row->set_inflated_columns({ foo => undef, });
    say 'The value is: '.$row->get_column('foo');
    say 'The value is: '.$row->foo;

would do different things.  The first prints

    The value is: 
    The value is: 

the second prints

    The value is: 
    The value is: 2016-06-23T16:42:34

Because `update` uses `set_inflated_columns`, the same behavior is visible there.

This change makes `set_inflated_columns` call `set_inflated_column` when the column is inflated and new value is `undef` (which `set_inflated_column` handles correctly), which causes the two functions to behave identically in this case, which seems like the correct behavior.
You can view, comment on, or merge this pull request online at:

  https://github.com/dbsrgits/dbix-class/pull/106

-- Commit Summary --

  * Treat undef like blessed objects for the purpose of looking for special handling

-- File Changes --

    M lib/DBIx/Class/Row.pm (2)

-- Patch Links --

https://github.com/dbsrgits/dbix-class/pull/106.patch
https://github.com/dbsrgits/dbix-class/pull/106.diff

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/dbsrgits/dbix-class/pull/106
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class-devel/attachments/20160627/0efbc0ed/attachment.htm>


More information about the DBIx-Class-Devel mailing list