author | Simon Howkins <simonh@symbian.org> |
Mon, 05 Oct 2009 11:22:09 +0100 | |
changeset 579 | 78b42fd9e2c4 |
parent 89 | a8aa5d600806 |
permissions | -rw-r--r-- |
89
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
1 |
# NOTE: Derived from blib\lib\Text\CSV.pm. |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
2 |
# Changes made here will be lost when autosplit again. |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
3 |
# See AutoSplit.pm. |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
4 |
package Text::CSV; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
5 |
|
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
6 |
#line 125 "blib\lib\Text\CSV.pm (autosplit into blib\lib\auto/Text\CSV/combine.al)" |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
7 |
################################################################################ |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
8 |
# combine |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
9 |
# |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
10 |
# object method returning success or failure. the given arguments are |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
11 |
# combined into a single comma-separated value. failure can be the result of |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
12 |
# no arguments or an argument containing an invalid character. side-effects |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
13 |
# include: |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
14 |
# setting status() |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
15 |
# setting fields() |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
16 |
# setting string() |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
17 |
# setting error_input() |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
18 |
################################################################################ |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
19 |
sub combine { |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
20 |
my $self = shift; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
21 |
my @part = @_; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
22 |
$self->{'_FIELDS'} = \@part; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
23 |
$self->{'_ERROR_INPUT'} = undef; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
24 |
$self->{'_STATUS'} = 0; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
25 |
$self->{'_STRING'} = ''; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
26 |
my $column = ''; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
27 |
my $combination = ''; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
28 |
my $skip_comma = 1; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
29 |
if ($#part >= 0) { |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
30 |
|
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
31 |
# at least one argument was given for "combining"... |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
32 |
for $column (@part) { |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
33 |
if ($column =~ /[^\t\040-\176]/) { |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
34 |
|
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
35 |
# an argument contained an invalid character... |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
36 |
$self->{'_ERROR_INPUT'} = $column; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
37 |
return $self->{'_STATUS'}; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
38 |
} |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
39 |
if ($skip_comma) { |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
40 |
|
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
41 |
# do not put a comma before the first argument... |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
42 |
$skip_comma = 0; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
43 |
} else { |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
44 |
|
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
45 |
# do put a comma before all arguments except the first argument... |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
46 |
$combination .= ','; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
47 |
} |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
48 |
$column =~ s/\042/\042\042/go; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
49 |
$combination .= "\042"; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
50 |
$combination .= $column; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
51 |
$combination .= "\042"; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
52 |
} |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
53 |
$self->{'_STRING'} = $combination; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
54 |
$self->{'_STATUS'} = 1; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
55 |
} |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
56 |
return $self->{'_STATUS'}; |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
57 |
} |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
58 |
|
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
59 |
# end of Text::CSV::combine |
a8aa5d600806
Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
60 |
1; |