Accepting request 72103 from devel:languages:perl
OBS-URL: https://build.opensuse.org/request/show/72103 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/perl-Text-CSV_XS?expand=0&rev=19
This commit is contained in:
commit
75d8eae079
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:678ff0d37eec7d8954ba4e37a9ee8be7222bd9312d4e0bdc6890780bc72cf791
|
|
||||||
size 112866
|
|
3
Text-CSV_XS-0.82.tgz
Normal file
3
Text-CSV_XS-0.82.tgz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:3a4000b37efa2b6fc18e1464b4bb139ae85bc6f3ab832b009f9cc9009ec6999b
|
||||||
|
size 113305
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon May 16 08:47:46 UTC 2011 - coolo@opensuse.org
|
||||||
|
|
||||||
|
- updated to 0.82
|
||||||
|
* Doc fix (RT#66905, Peter Newman)
|
||||||
|
* Documentation overhaul (pod links)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Mar 31 08:45:11 UTC 2011 - coolo@novell.com
|
Thu Mar 31 08:45:11 UTC 2011 - coolo@novell.com
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# spec file for package perl-Text-CSV_XS
|
# spec file for package perl-Text-CSV_XS (Version 0.82)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
@ -15,26 +15,18 @@
|
|||||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Name: perl-Text-CSV_XS
|
Name: perl-Text-CSV_XS
|
||||||
Version: 0.81
|
Version: 0.82
|
||||||
Release: 1
|
Release: 1
|
||||||
License: GPL+ or Artistic
|
License: GPL+ or Artistic
|
||||||
%define cpan_name Text-CSV_XS
|
%define cpan_name Text-CSV_XS
|
||||||
Summary: comma-separated values manipulation routines
|
Summary: comma-separated values manipulation routines
|
||||||
Url: http://search.cpan.org/dist/Text-CSV_XS/
|
Url: http://search.cpan.org/dist/Text-CSV_XS/
|
||||||
Group: Development/Libraries/Perl
|
Group: Development/Libraries/Perl
|
||||||
#Source: http://www.cpan.org/authors/id/H/HM/HMBRAND/Text-CSV_XS-%{version}.tgz
|
Source: http://www.cpan.org/authors/id/H/HM/HMBRAND/%{cpan_name}-%{version}.tgz
|
||||||
Source: %{cpan_name}-%{version}.tgz
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
BuildRequires: perl
|
BuildRequires: perl
|
||||||
BuildRequires: perl-macros
|
BuildRequires: perl-macros
|
||||||
BuildRequires: perl(Config)
|
|
||||||
BuildRequires: perl(DynaLoader)
|
|
||||||
BuildRequires: perl(IO::Handle)
|
|
||||||
Requires: perl(DynaLoader)
|
|
||||||
Requires: perl(IO::Handle)
|
|
||||||
%{perl_requires}
|
%{perl_requires}
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -46,71 +38,9 @@ The module accepts either strings or files as input and can utilize any
|
|||||||
user-specified characters as delimiters, separators, and escapes so it is
|
user-specified characters as delimiters, separators, and escapes so it is
|
||||||
perhaps better called ASV (anything separated values) rather than just CSV.
|
perhaps better called ASV (anything separated values) rather than just CSV.
|
||||||
|
|
||||||
Embedded newlines
|
|
||||||
*Important Note*: The default behavior is to only accept ASCII
|
|
||||||
characters. This means that fields can not contain newlines. If your
|
|
||||||
data contains newlines embedded in fields, or characters above 0x7e
|
|
||||||
(tilde), or binary data, you *must* set 'binary => 1' in the call to
|
|
||||||
'new'. To cover the widest range of parsing options, you will always
|
|
||||||
want to set binary.
|
|
||||||
|
|
||||||
But you still have the problem that you have to pass a correct line to
|
|
||||||
the 'parse' method, which is more complicated from the usual point of
|
|
||||||
usage:
|
|
||||||
|
|
||||||
my $csv = Text::CSV_XS->new ({ binary => 1, eol => $/ });
|
|
||||||
while (<>) { # WRONG!
|
|
||||||
$csv->parse ($_);
|
|
||||||
my @fields = $csv->fields ();
|
|
||||||
|
|
||||||
will break, as the while might read broken lines, as that does not care
|
|
||||||
about the quoting. If you need to support embedded newlines, the way to
|
|
||||||
go is either
|
|
||||||
|
|
||||||
my $csv = Text::CSV_XS->new ({ binary => 1, eol => $/ });
|
|
||||||
while (my $row = $csv->getline (*ARGV)) {
|
|
||||||
my @fields = @$row;
|
|
||||||
|
|
||||||
or, more safely in perl 5.6 and up
|
|
||||||
|
|
||||||
my $csv = Text::CSV_XS->new ({ binary => 1, eol => $/ });
|
|
||||||
open my $io, "<", $file or die "$file: $!";
|
|
||||||
while (my $row = $csv->getline ($io)) {
|
|
||||||
my @fields = @$row;
|
|
||||||
|
|
||||||
Unicode (UTF8)
|
|
||||||
On parsing (both for 'getline' and 'parse'), if the source is marked
|
|
||||||
being UTF8, then all fields that are marked binary will also be be
|
|
||||||
marked UTF8.
|
|
||||||
|
|
||||||
For complete control over encoding, please use Text::CSV::Encoded:
|
|
||||||
|
|
||||||
use Text::CSV::Encoded;
|
|
||||||
my $csv = Text::CSV::Encoded->new ({
|
|
||||||
encoding_in => "iso-8859-1", # the encoding comes into Perl
|
|
||||||
encoding_out => "cp1252", # the encoding comes out of Perl
|
|
||||||
});
|
|
||||||
|
|
||||||
$csv = Text::CSV::Encoded->new ({ encoding => "utf8" });
|
|
||||||
# combine () and print () accept *literally* utf8 encoded data
|
|
||||||
# parse () and getline () return *literally* utf8 encoded data
|
|
||||||
|
|
||||||
$csv = Text::CSV::Encoded->new ({ encoding => undef }); # default
|
|
||||||
# combine () and print () accept UTF8 marked data
|
|
||||||
# parse () and getline () return UTF8 marked data
|
|
||||||
|
|
||||||
On combining ('print' and 'combine'), if any of the combining fields
|
|
||||||
was marked UTF8, the resulting string will be marked UTF8. Note however
|
|
||||||
that all fields 'before' the first field that was marked UTF8 and
|
|
||||||
contained 8-bit characters that were not upgraded to UTF8, these will
|
|
||||||
be bytes in the resulting string too, causing errors. If you pass data
|
|
||||||
of different encoding, or you don't know if there is different
|
|
||||||
encoding, force it to be upgraded before you pass them on:
|
|
||||||
|
|
||||||
$csv->print ($fh, [ map { utf8::upgrade (my $x = $_); $x } @data ]);
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n %{cpan_name}-%{version}
|
%setup -q -n %{cpan_name}-%{version}
|
||||||
|
find . -type f -print0 | xargs -0 chmod 644
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
|
%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
|
||||||
@ -128,7 +58,7 @@ Unicode (UTF8)
|
|||||||
%{__rm} -rf %{buildroot}
|
%{__rm} -rf %{buildroot}
|
||||||
|
|
||||||
%files -f %{name}.files
|
%files -f %{name}.files
|
||||||
%defattr(644,root,root,755)
|
%defattr(-,root,root,755)
|
||||||
%doc ChangeLog README
|
%doc ChangeLog examples README
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
Loading…
x
Reference in New Issue
Block a user