This queue is for tickets about the Text-CSV_XS CPAN distribution.

Report information
The Basics
Id:
76143
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
Carl.Johnstone [...] onthebeach.co.uk
Cc:
AdminCc:

BugTracker
Severity:
Wishlist
Broken in:
(no value)
Fixed in:
0.95



Subject: wishlist: print_hr
Date: Thu, 29 Mar 2012 15:14:32 +0100
To: "bug-Text-CSV_XS@rt.cpan.org" <bug-Text-CSV_XS@rt.cpan.org>
From: Carl Johnstone <Carl.Johnstone@onthebeach.co.uk>
Would it be possible to add a print_hr method to match the getline_hr method? I see it working something like this: sub print_hr { my ($self, $handle, $hashref) = @_; my @out_ary; foreach my $col ($self->column_names) { my $val = undef; if (exists $hashref->{$col} ) { $val = $hashref->{$col} } push(@out_ary,$val); } $self->print($handle, \@out_ary); } Thanks Carl
It will be in the next release, though your code is overly complicated. My new print_hr function is just a wrapper which translates $csv->print_hr ($io, $ref); to $csv->print ($io, [ map { $ref->{$_} } $csv->column_names ]); adding basic parameter checking


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.