[Bps-public-commit] r18478 - Net-Trac/trunk/lib/Net/Trac
jesse at bestpractical.com
jesse at bestpractical.com
Thu Feb 19 18:15:02 EST 2009
Author: jesse
Date: Thu Feb 19 18:15:02 2009
New Revision: 18478
Modified:
Net-Trac/trunk/lib/Net/Trac/Connection.pm
Log:
start to cut down text::csv usage
Modified: Net-Trac/trunk/lib/Net/Trac/Connection.pm
==============================================================================
--- Net-Trac/trunk/lib/Net/Trac/Connection.pm (original)
+++ Net-Trac/trunk/lib/Net/Trac/Connection.pm Thu Feb 19 18:15:02 2009
@@ -206,7 +206,7 @@
sub _csv_to_struct {
my $self = shift;
- my %args = validate( @_, { data => 1, key => 1, type => { default => 'hash' } } );
+ my %args = validate( @_, { data => 1, key => 1, type => 1 } );
my $csv = Text::CSV_XS->new( { binary => 1 } );
my $x = $args{'data'};
my $io = IO::Scalar->new($x);
@@ -214,13 +214,8 @@
return unless defined $cols[0];
$csv->column_names(@cols);
my $data;
-
- if ( lc $args{'type'} eq 'hash' ) {
- while ( my $row = $csv->getline_hr($io) ) {
- $data->{ $row->{ $args{'key'} } } = $row;
- }
- }
- elsif ( lc $args{'type'} eq 'array' ) {
+
+ if ( lc $args{'type'} eq 'array' ) {
while ( my $row = $csv->getline_hr($io) ) {
push @$data, $row;
}
More information about the Bps-public-commit
mailing list