~ubuntu-branches/ubuntu/precise/libjifty-dbi-perl/precise

« back to all changes in this revision

Viewing changes to lib/Jifty/DBI/Filter/Boolean.pm

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Yu
  • Date: 2010-12-25 20:52:02 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20101225205202-lnacq0abuqygrlhm
Tags: 0.64-1
* New upstream release
* Refresh copyright information
* Use new 3.0 (quilt) source format
* Standards-Version 3.9.1 (no changes)
* Drop version deps satisfied by oldstable
* POD tests are now author-only

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 
43
43
=head2 decode
44
44
 
45
 
Transform the value into 1 or 0 so Perl's concept of the boolean's value agrees
46
 
with the database's concept of the boolean's value. (For example, 't' and 'f'
47
 
might be used -- 'f' is true in Perl)
 
45
Transform the value into 1 or 0 so Perl's concept of the value agrees
 
46
with the database's concept of the value. (For example, 't' and 'f'
 
47
might be used in the database, but 'f' is true in Perl)
48
48
 
49
49
=cut
50
50
 
77
77
    my $self = shift;
78
78
    my $value_ref = $self->value_ref;
79
79
 
80
 
    return unless defined $$value_ref or $self->column->mandatory;
81
 
    return if uc $$value_ref eq "NULL" and not $self->column->mandatory;
 
80
    return unless defined($$value_ref) or $self->column->mandatory;
 
81
    return if uc($$value_ref||'') eq "NULL" and not $self->column->mandatory;
82
82
 
83
83
    if ($self->_is_true($$value_ref)) {
84
84
        $$value_ref = $self->handle->canonical_true;