I donβt know of any DBIC printable modules, but they are easy to implement from any of the many textual, html or other types of table output modules on CPAN.
Below is my quick working example using Text::Table
use 5.012;
use warnings;
use List::MoreUtils 'zip';
use Text::Table;
use MySchema;
my $db = MySchema->connect( "DBI:SQLite:myschema_db" );
my $album = $db->resultset( 'Album' );
my @cols = $album->result_source->columns;
my $table = Text::Table->new( header( @cols ) );
while (my $cd = $album->next) {
$table->add( map { $cd->get_column( $_ ) } @cols );
}
print $table;
sub header {
my @sep = (\' | ') x @_;
zip @_, @sep;
}
This leads to the following results with my test data:
albumid | artist | title | rank |
1 | Lou Reed | Transformer | |
2 | Lou Reed | Berlin | |
3 | David Bowie | Ziggy Stardust | |
4 | Japan | Tin Drum | |
/ I3az /
source
share