- Timestamp:
- Oct 26, 2006, 4:15:45 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/PS-IPP-Metadata-Config/lib/PS/IPP/Metadata/Config.pm
r9496 r9758 1 1 # Copyright (c) 2005 Joshua Hoblitt 2 2 # 3 # $Id: Config.pm,v 1.2 6 2006-10-12 02:09:10jhoblitt Exp $3 # $Id: Config.pm,v 1.27 2006-10-27 02:15:45 jhoblitt Exp $ 4 4 5 5 package PS::IPP::Metadata::Config; … … 49 49 # multi-symbols 50 50 $self->_merge_duplicates( $tree ) or return undef; 51 52 # translate NULL values into perl undefs (Parse::RecDescent can't return 53 # undefs, args) 54 $self->_fix_nulls( $tree ) or return undef; 51 55 52 56 #print Dumper($tree); … … 106 110 } 107 111 112 sub _fix_nulls { 113 my ( $self, $tree ) = @_; 114 115 # Iteratate through the parse tree looking for values of NULL and 116 # translating them into Perl undefs 117 for (my $i = 0; $i < @{$tree}; $i++) { 118 my $elem = $tree->[$i]; 119 120 # recurse through nested metadata 121 if ( $elem->{class} eq "metadata" ) { 122 $self->_fix_nulls( $elem->{value} ); 123 } 124 125 # force stringification of $elem->{value} -- specifically because you 126 # can't compare a DateTime object to a string value 127 if ("$elem->{value}" eq "NULL") { 128 $elem->{value} = undef; 129 } 130 } 131 132 return 1; 133 } 134 108 135 1; 109 136
Note:
See TracChangeset
for help on using the changeset viewer.
