|
Well this module is great (thx DJ), nice and easy to get the job done, the trouble I ran into was with trying to export CSV files for MYOB sales items, MYOB delimits its invoices using blank lines so I made the changes below to achieve that, although calling add_line with an empty hashref allowed the import it created a whole bunch of errors in MYOB.
sub add_line {
my ($self, $args) = @_;
#die "Cannot call add_line without an argument!\n"
# unless (defined $args and $args);
my $line = '';
if (defined $args and $args){
$line = $self->new_line($args);
}
push(@{$self->{lines}}, $line);
}
sub string {
my ($self) = @_;
die "No lines to write!\n" unless (ref $self->lines() eq 'ARRAY');
my @string = ();
#map { push(@string, $_->string()); } @{$self->lines()};
foreach my $ob (@{$self->lines()}){
if ($ob){
push(@string, $ob->string());
}else{
push(@string, $ob);
}
}
return join($self->line_separator(), @string). $self->line_separator();
}
|