|
Lines 46-59
my $csv = Text::CSV_XS->new({
Link Here
|
| 46 |
my $content = $csv_profile->content; |
46 |
my $content = $csv_profile->content; |
| 47 |
my ( @headers, @fields ); |
47 |
my ( @headers, @fields ); |
| 48 |
while ( $content =~ / |
48 |
while ( $content =~ / |
| 49 |
([^=]+) # header |
49 |
([^=\|]+) # header |
| 50 |
= |
50 |
=? |
| 51 |
([^\|]+) # fieldname (table.row or row) |
51 |
([^\|]*) # fieldname (table.row or row) |
| 52 |
\|? /gxms |
52 |
\|? /gxms |
| 53 |
) { |
53 |
) { |
| 54 |
push @headers, $1; |
54 |
my $header = $1; |
| 55 |
my $field = $2; |
55 |
my $field = ($2 eq '') ? $1 : $2; |
| 56 |
$field =~ s/[^\.]*\.?//; # Remove the table name if exists. |
56 |
|
|
|
57 |
$header =~ s/^\s+|\s+$//g; # Trim whitespaces |
| 58 |
push @headers, $header; |
| 59 |
|
| 60 |
$field =~ s/[^\.]*\.{1}//; # Remove the table name if exists. |
| 61 |
$field =~ s/^\s+|\s+$//g; # Trim whitespaces |
| 57 |
push @fields, $field; |
62 |
push @fields, $field; |
| 58 |
} |
63 |
} |
| 59 |
|
64 |
|
| 60 |
- |
|
|