Changeset 19616 for gsdl/trunk


Ignore:
Timestamp:
2009-05-27T13:52:35+12:00 (15 years ago)
Author:
kjdon
Message:

added tidy_up_oid method, which deals with periods, numeric ids and trailing and leading spaces

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/util.pm

    r19056 r19616  
    635635}
    636636
    637 
     637sub tidy_up_oid {
     638    my ($OID) = @_;
     639    if ($OID =~ /\./) {
     640    print STDERR "Warning, identifier $OID contains periods (.), removing them\n";
     641    $OID =~ s/\.//g; #remove any periods
     642    }
     643    if ($OID =~ /^\s.*\s$/) {
     644    print STDERR "Warning, identifier $OID starts or ends with whitespace. Removing it\n";
     645    # remove starting and trailing whitespace
     646    $OID =~ s/^\s+//;
     647    $OID =~ s/\s+$//;
     648    }
     649    if ($OID =~ /^[\d]*$/) {
     650    print STDERR "Warning, identifier $OID contains only digits. Prepending 'D'.\n";
     651    $OID = "D" . $OID;
     652    }       
     653   
     654    return $OID;
     655}
    638656sub envvar_prepend {
    639657    my ($var,$val) = @_;
Note: See TracChangeset for help on using the changeset viewer.