[Rt-commit] r6533 - in rt/branches/3.7-EXPERIMENTAL: . sbin

ruz at bestpractical.com ruz at bestpractical.com
Sun Nov 26 17:48:02 EST 2006


Author: ruz
Date: Sun Nov 26 17:48:01 2006
New Revision: 6533

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Record.pm
   rt/branches/3.7-EXPERIMENTAL/sbin/rt-test-dependencies.in

Log:
 r4190 at cubic-pc:  cubic | 2006-11-27 01:51:26 +0300
  r3568 at cubic-pc:  cubic | 2006-07-27 23:49:44 +0400
  * add Encode 2.13 to the requirements
  * add 'use warnings'
  * perl 5.8.3 is required so drop Encode::compat
  * drop is_utf8 checks in __Value as bug in Encode module was fixed
  * "unless ( defined $x && $x )" is equivalent to "unless ( $x )"
  * don't return empty strings instead of undef so NULL can be
    distinguished from empty strings
 


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Record.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Record.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Record.pm	Sun Nov 26 17:48:01 2006
@@ -65,12 +65,16 @@
 =cut
 
 package RT::Record;
+
+use strict;
+use warnings;
+
 use RT::Date;
 use RT::User;
 use RT::Attributes;
 use RT::Base;
 
-use strict;
+use Encode ();
 
 our $_TABLE_ATTR;
 our @ISA = qw(RT::Base);
@@ -636,34 +640,20 @@
 
 }
 
-require Encode::compat if $] < 5.007001;
-require Encode;
-
-
-
-
 sub __Value {
     my $self  = shift;
     my $field = shift;
-    my %args = ( decode_utf8 => 1,
-                 @_ );
+    my %args = ( decode_utf8 => 1, @_ );
 
-    unless (defined $field && $field) {
-        $RT::Logger->error("$self __Value called with undef field");
+    unless ( $field ) {
+        $RT::Logger->error("__Value called with undef field");
     }
-    my $value = $self->SUPER::__Value($field);
-
-    return('') if ( !defined($value) || $value eq '');
 
     if( $args{'decode_utf8'} ) {
-    	# XXX: is_utf8 check should be here unless Encode bug would be fixed
-        # see http://rt.cpan.org/NoAuth/Bug.html?id=14559 
-        return Encode::decode_utf8($value) unless Encode::is_utf8($value);
+        return Encode::decode_utf8( $self->SUPER::__Value( $field ) );
     } else {
-        # check is_utf8 here just to be shure
-        return Encode::encode_utf8($value) if Encode::is_utf8($value);
+        return Encode::encode_utf8( $self->SUPER::__Value( $field ) );
     }
-    return $value;
 }
 
 # Set up defaults for DBIx::SearchBuilder::Record::Cachable

Modified: rt/branches/3.7-EXPERIMENTAL/sbin/rt-test-dependencies.in
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/sbin/rt-test-dependencies.in	(original)
+++ rt/branches/3.7-EXPERIMENTAL/sbin/rt-test-dependencies.in	Sun Nov 26 17:48:01 2006
@@ -207,6 +207,7 @@
 Cache::Simple::TimedExpiry
 XML::Simple
 Calendar::Simple
+Encode 2.13
 .
 
 $deps{'MASON'} = [ text_to_hash( << '.') ];


More information about the Rt-commit mailing list