#!/usr/bin/env perl # Copyright (c) 2015-2019 Christian Jaeger, copying@christianjaeger.ch # This is free software. See the file COPYING.md that came bundled # with this file. use strict; use warnings; use warnings FATAL => 'uninitialized'; # find modules from functional-perl working directory (not installed) use Cwd 'abs_path'; our ($mydir, $myname); BEGIN { my $location = (-l $0) ? abs_path($0) : $0; $location =~ /(.*?)([^\/]+?)_?\z/s or die "?"; ($mydir, $myname) = ($1, $2); } use lib "$mydir/../lib"; use Chj::TEST use => "DBD::CSV", use => "FP::DBI"; # 'DBI' really, indirectly use PXML::XHTML ":all"; use FP::Weak; use Chj::Backtrace; our $db = FP::DBI->connect("dbi:CSV:"); $db->{csv_sep_char} = ";"; our $get = $db->prepare("select * from examples/csv_to_xml-example.csv"); TEST { $get->execute(); my $s = $get->row_stream; TABLE(TH($s->first->map (\&TD)), $s->rest->take(10)->map (sub { TR($_[0]->map (\&TD)) }))->string; } '
1 | 2 | 3 | 4 | ' . '
4 | 3.3 | foo | bar |