blib/lib/DBI/Format/CSV.pm

filter: Statementstmt 100% 36 / 36 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 3 totaltotal 93.4% 43 / 46 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/DBI/Shell/Timing.pm ↑ Summary dbish_config »
1 # -*- perl -*-
2 # vim:ts=4:sw=4:aw:ai:
3 #
4 # DBI::Format::CSV - a package for displaying result tables
5 #
6 # Copyright (c) 2001, 2002 Thomas A. Lowery
7 #
8 # The DBI::Shell::CSV module is free software; you can redistribute
9 # it and/or modify it under the same terms as Perl itself.
10 #
11  
12 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 package DBI::Format::CSV;
15  
16 1 our $VERSION = '11.98'; # VERSION
17  
18 1 @DBI::Format::CSV::ISA = qw(DBI::Format::Base);
19  
20 1 ▶use Text::Abbrev;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use Text::Reform qw(form break_with);
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use Text::CSV_XS;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 3 ▶sub header {
Subroutine header: called CC=1 SCAR=0.0
Pod undocumented
25 3 my ($self, $sth, $fh, $sep) = @_;
26 3 $self->SUPER::header($sth, $fh, $sep);
27 3 $self->{'data'} = [];
28 3 $self->{'formats'} = [];
29  
30 $self->{csv_obj} = Text::CSV_XS->new({
31 binary => 1,
32 sep_char => $self->{sep},
33 3 always_quote => 1,
34 });
35  
36 3 my $names = $sth->{'NAME'};
37 3 my $csv = $self->{csv_obj};
38 3 my $status = $csv->print($fh, $names);
39 3 $fh->print( "\n" );
40 3 return 1;
41 }
42  
43 30 ▶sub row {
Subroutine row: called CC=1 SCAR=0.0
Pod undocumented
44 30 my($self, $orig_row) = @_;
45 30 my $i = 0;
46 30 my @row = $self->SUPER::row([@$orig_row]); # don't alter original
47  
48 30 my $columns = $self->{'columns'};
49 30 my $breaks = $self->{'breaks'};
50  
51 30 my $fh = $self->{'fh'};
52 30 my $csv = $self->{csv_obj};
53 30 my $status = $csv->print($fh, \@row);
54 30 $fh->print( "\n" );
55  
56 30 return ++$self->{rows};
57 }
58  
59  
60 3 ▶sub trailer {
Subroutine trailer: called CC=1 SCAR=0.0
Pod undocumented
61 3 my $self = shift;
62 # $self->SUPER::trailer(@_);
63 }
64  
65 1 1;
66  
67 =head1 NAME
68  
69 DBI::Format::CSV - A package for displaying result tables
70  
71 =head1 SYNOPSIS
72  
73 =head1 DESCRIPTION
74  
75 THIS PACKAGE IS STILL VERY EXPERIMENTAL. THINGS WILL CHANGE.
76  
77 =head1 AUTHOR AND COPYRIGHT
78  
79 Orignal Format module is Copyright (c) 1997, 1998
80  
81 Jochen Wiedmann
82 Am Eisteich 9
83 72555 Metzingen
84 Germany
85  
86 Email: joe@ispsoft.de
87 Phone: +49 7123 14887
88  
89 SQLMinus is Copyright (c) 2001, 2002 Thomas A. Lowery
90  
91 The DBI::Format::CSV module is free software; you can redistribute it and/or
92 modify it under the same terms as Perl itself.
93  
94  
95 =head1 SEE ALSO
96  
97 L<DBI::Shell>, L<DBI>, L<dbish>
« blib/lib/DBI/Shell/Timing.pm ↑ Summary dbish_config »