IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8740


Ignore:
Timestamp:
Sep 5, 2006, 3:53:49 PM (20 years ago)
Author:
jhoblitt
Message:

change ::Stats->parse() to return undef when parse errors are encountered

File:
1 edited

Legend:

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

    r8739 r8740  
    11# Copyright (c) 2006  Paul Price, Joshua Hoblitt
    22#
    3 # $Id: Stats.pm,v 1.6 2006-09-06 01:47:38 jhoblitt Exp $
     3# $Id: Stats.pm,v 1.7 2006-09-06 01:53:49 jhoblitt Exp $
    44
    55package PS::IPP::Metadata::Stats;
     
    5858    my $self = shift;                # Where we'll put the information
    5959    my $md = shift;                # Parsed metadata, from PS::IPP::Metadata::Config
     60
     61    # count of parse errors
     62    my $errors = 0;
    6063
    6164    # Descend the FPA hierarchy
     
    109112            if (not defined $self->{data}->{$constant}->{value}) {
    110113                carp "Unable to find value for ", $constant, "\n";
     114                $errors++;
    111115            }
    112116        }
     
    121125            if (scalar @$array == 0) {
    122126                carp "Unable to find any values for ", $variable, "\n";
     127                $errors++;
    123128                next;
    124129            }
     
    150155    }
    151156
     157    if ($errors) {
     158        carp "a total of $errors parse errors occured";
     159        return;
     160    }
     161
    152162    return $self;
    153163}
Note: See TracChangeset for help on using the changeset viewer.