IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 20, 2007, 3:53:13 PM (19 years ago)
Author:
Paul Price
Message:

Adding function to lookup boolean value.

File:
1 edited

Legend:

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

    r14400 r14575  
    11# Copyright (c) 2006  Paul Price, Joshua Hoblitt
    22#
    3 # $Id: Config.pm,v 1.63 2007-08-01 20:50:32 jhoblitt Exp $
     3# $Id: Config.pm,v 1.64 2007-08-21 01:53:13 price Exp $
    44
    55package PS::IPP::Config;
     
    2929                    metadataLookupStr
    3030                    metadataLookupMD
     31                    metadataLookupBool
    3132                    caturi
    3233                    );
     
    881882}
    882883
     884# Lookup the metadata, checking the type is BOOL
     885sub metadataLookupBool
     886{
     887    my $mdc = shift;            # Metadata config to look up
     888    my $name = shift;           # Name of item to look ip
     889
     890    unless (defined $mdc and defined $name) {
     891        carp "Programming error";
     892        exit($PS_EXIT_PROG_ERROR);
     893    }
     894
     895    # Iterate through the array of hashes
     896    foreach my $item (@$mdc) {
     897        if ($item->{name} eq $name) {
     898            carp "$name within metadata is not of type BOOL.\n" unless $item->{class} eq "bool";
     899            return $item->{value};
     900        }
     901    }
     902
     903    carp "Unable to find $name within metadata.\n";
     904    return undef;
     905}
     906
    883907# Lookup the metadata, checking the type is MD; may be redirection
    884908sub _mdLookupMDwithRedirect
Note: See TracChangeset for help on using the changeset viewer.