Data-Timeline

 view release on metacpan or  search on metacpan

lib/Data/Timeline/Formatter/SimpleTable.pm  view on Meta::CPAN

        my @row = (sprintf "%s" => $entry->timestamp);
        for my $col_type (@col_types) {
            if ($entry->type eq $col_type) {
                push @row => $entry->description;
            } else {
                push @row => '';
            }
        }
        $table->row(@row);
    }
    print $table->draw;
}
1;


__END__
=pod

=for test_synopsis my $timeline;

=head1 NAME

Data::Timeline::Formatter::SimpleTable - Print time line entry types side-by-side in a text table

=head1 VERSION

version 1.100860

=head1 SYNOPSIS

    Data::Timeline::Formatter::SimpleTable->new(
        columns => [ [ 40, 'iscrobbler' ], [ 40, 'svk' ] ],
    )->format($timeline);

=head1 DESCRIPTION

This class is a time line formatter. It takes a time line containing entries
of one or more entry types and a column definition. The column definition says
for each column how wide it should be and which type of entries it should
contain. The formatter's C<format()> method will then print a simple text
table containing the requested columns, with a column for the timestamp at the
beginning.

The column definition is a list of C<[ $width, $type ]> pairs. So for the
example in the synopsis, the first column would contain the timestamp, the
second column would be 40 characters wide and contain C<iscrobbler> entries,
produced by L<Data::Timeline::IScrobbler>, and the third column would also
be 40 characters wide and contain C<svk> entries, produced by
L<Data::Timeline::SVK>.

=head1 METHODS

=head2 format

FIXME

=head1 INSTALLATION

See perlmodinstall for information and options on installing Perl modules.

=head1 BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests through the web interface at
L<http://rt.cpan.org/Public/Dist/Display.html?Name=Data-Timeline>.

=head1 AVAILABILITY

The latest version of this module is available from the Comprehensive Perl
Archive Network (CPAN). Visit L<http://www.perl.com/CPAN/> to find a CPAN
site near you, or see
L<http://search.cpan.org/dist/Data-Timeline/>.

The development version lives at
L<http://github.com/hanekomu/Data-Timeline/>.
Instead of sending patches, please fork this project using the standard git
and github infrastructure.

=head1 AUTHOR

  Marcel Gruenauer <marcel@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2007 by Marcel Gruenauer.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut



( run in 0.922 second using v1.01-cache-2.11-cpan-39bf76dae61 )