projects
/
MojoFacets.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
53588a2
)
create export of all data in tab-separated format
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 22 Jun 2010 15:29:47 +0000
(17:29 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 22 Jun 2010 15:29:47 +0000
(17:29 +0200)
lib/MojoFacets/Data.pm
patch
|
blob
|
history
diff --git
a/lib/MojoFacets/Data.pm
b/lib/MojoFacets/Data.pm
index
e2a93af
..
b5a74a6
100644
(file)
--- a/
lib/MojoFacets/Data.pm
+++ b/
lib/MojoFacets/Data.pm
@@
-739,6
+739,21
@@
sub items {
push @$sorted_items, $row;
}
push @$sorted_items, $row;
}
+ my $export_path = "public/export/$path/" . join('.', @columns);
+ open(my $fh, '>', $export_path) || warn "ERROR: can't open $export_path: $!";
+ foreach my $f ( 0 .. $#$filtered ) {
+ print $fh join("\t", map {
+ my $i = $data->{items}->[ $filtered->[$f] ];
+ if ( ref $i->{$_} eq 'ARRAY' ) {
+ join(',', @{ $i->{$_} });
+ } else {
+ dump $i->{$_};
+ }
+ } @columns),"\n";
+ }
+ close($fh);
+ warn "$export_path ", -s $export_path, " bytes\n";
+
warn "# test_changed ",dump( $test_changed );
my $c = { map { $_ => 1 } @columns };
my @added_columns = sort grep { ! $c->{$_} } keys %$test_changed;
warn "# test_changed ",dump( $test_changed );
my $c = { map { $_ => 1 } @columns };
my @added_columns = sort grep { ! $c->{$_} } keys %$test_changed;