Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Item names all upper case

  • Loading branch information...
commit 1407ada831a453d1d8e85f68e898334c79304f2c 1 parent c22be07
@f-marais authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 script/xlstodb.pl
View
8 script/xlstodb.pl
@@ -1,6 +1,7 @@
#!/usr/bin/env perl
use warnings;
use strict;
+use 5.010;
use Spreadsheet::ParseExcel;
use Getopt::Std;
use Data::Dumper;
@@ -34,7 +35,7 @@ sub assign_cols {
for my $table ( keys %{ $lkps->{$side} } ) {
for my $attr ( keys %{ $lkps->{$side}{$table} } ) {
if ( $lkps->{$side}{$table}{$attr}{Column} =~ m/$val/i ) {
- $lkps->{$side}{$table}{$attr}{Num} = $col;
+ $lkps->{$side}{$table}{$attr}{Num} = $col=~tr/a-z/A-Z/r;
$ENV{DEBUG}
&& print "Assigning column $col for $side,$table,"
. "$attr:$val";
@@ -212,6 +213,7 @@ sub assign_val {
&& defined $tgt->{item}{name}{value}
&& $tgt->{item}{name}{value} !~ /^\s*$/ )
{
+ $tgt->{item}{name}{value}=~tr/a-z/A-Z/; # Item names upper case
$tgt_itm_nm = $tgt->{item}{name}{value};
$tgt_itm_nm =~ s/[^[:print:]]+/ /;
print "Inserting item $tgt_itm_nm in $tgt_ent_nm\n" if $ENV{DEBUG};
@@ -267,7 +269,7 @@ sub assign_val {
&& $tgt->{item}{name}{value} )
{
$curr_itm{ent_nm} = $tgt->{entity}{ds_name}{value};
- $curr_itm{itm_nm} = $tgt->{item}{name}{value};
+ $curr_itm{itm_nm} = $tgt->{item}{name}{value}=~tr/a-z/A-Z/r;
}
$ENV{DEBUG} && print "Current tgt ent: $curr_itm{ent_nm}
item: $curr_itm{itm_nm}\n";
@@ -283,6 +285,7 @@ sub assign_val {
next
unless $src->{item}{name}{value}
&& $src->{item}{name}{value} !~ m{n/a}ims;
+ $src->{item}{name}{value}=~tr/a-z/A-Z/;
$ENV{DEBUG} && print "Source item:", $src->{item}{name}{value}, "\n";
my @src_ents =
( $src->{entity}{ds_name}{value} =~ /\s*([A-Za-z0-9_.]+)\s*/gms );
@@ -290,6 +293,7 @@ sub assign_val {
my $enti = 0;
for my $itm ( $src_itm_nm =~ /\s*([A-Za-z0-9_.]+)\s*/gms ) {
my $dbix_src_et;
+ $itm=~tr/a-z/A-Z/; # Xlate item names to upper case
my $src_ent_nm = $src_ents[$enti];
if ( !exists $db{$src_ent_nm} ) {
$ENV{DEBUG} && print "Inserting source entity $src_ent_nm\n";
Please sign in to comment.
Something went wrong with that request. Please try again.