comparison lib/CPT/Writer/Spreadsheet/XLS.pm @ 1:f093e08f21f3 draft default tip

planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
author cpt
date Mon, 05 Jun 2023 02:47:24 +0000
parents
children
comparison
equal deleted inserted replaced
0:b8b8b52904a5 1:f093e08f21f3
1 package CPT::Writer::Spreadsheet::XLS;
2 use Moose;
3 with 'CPT::Writer', 'CPT::Writer::Spreadsheet';
4 use Spreadsheet::WriteExcel;
5
6 sub process {
7 my ($self) = @_;
8 if ( $self->galaxy_override ) {
9 die 'This class currently incompatible with Galaxy';
10 }
11 $self->OutputFilesClass->extension( $self->suffix() );
12 my $next_output_file = $self->OutputFilesClass->get_next_file();
13 my $workbook = Spreadsheet::WriteExcel->new($next_output_file);
14
15 my %data = %{ $self->data };
16 my @sheets = keys %data;
17 foreach (@sheets) {
18 my $current_worksheet = $workbook->add_worksheet($_);
19 my $data_struc_ref = $data{$_};
20
21 #R,C,AR
22 $current_worksheet->write_row( 0, 0,
23 ${$data_struc_ref}{'header'} );
24 my $row = 1;
25 foreach ( @{ ${$data_struc_ref}{'data'} } ) {
26 $current_worksheet->write_row( $row, 0, $_ );
27 $row++;
28 }
29 }
30 $self->processed_data($workbook);
31 $self->processing_complete(1);
32 }
33
34 sub write {
35 my ($self) = @_;
36 $self->processed_data()->close();
37 }
38
39 sub suffix {
40 return 'xls';
41 }
42 no Moose;
43 1;
44
45 __END__
46
47 =pod
48
49 =encoding UTF-8
50
51 =head1 NAME
52
53 CPT::Writer::Spreadsheet::XLS
54
55 =head1 VERSION
56
57 version 1.99.4
58
59 =head1 AUTHOR
60
61 Eric Rasche <rasche.eric@yandex.ru>
62
63 =head1 COPYRIGHT AND LICENSE
64
65 This software is Copyright (c) 2014 by Eric Rasche.
66
67 This is free software, licensed under:
68
69 The GNU General Public License, Version 3, June 2007
70
71 =cut