IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 26, 2006, 4:15:45 PM (20 years ago)
Author:
jhoblitt
Message:

fix time tests that were dependent on MULTI times being broken
fix MULTI time
no longer require the 'Z' and the end of ISO8601 times
implement NULL time support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/PS-IPP-Metadata-Config/lib/PS/IPP/Metadata/Config.pm

    r9496 r9758  
    11# Copyright (c) 2005  Joshua Hoblitt
    22#
    3 # $Id: Config.pm,v 1.26 2006-10-12 02:09:10 jhoblitt Exp $
     3# $Id: Config.pm,v 1.27 2006-10-27 02:15:45 jhoblitt Exp $
    44
    55package PS::IPP::Metadata::Config;
     
    4949    # multi-symbols
    5050    $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;
    5155
    5256    #print Dumper($tree);
     
    106110}
    107111
     112sub _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
    1081351;
    109136
Note: See TracChangeset for help on using the changeset viewer.