Tip:
is more idiomatically/simply written as$opt->{'encoding'} ? $opt->{'encoding'} : 'utf-8'
$opt->{encoding} || 'utf-8'
Tip:
could be simplified toif ( length($line) > 0 || $opt->{'empty'} && $opt->{'empty'} eq 'fill' + ) { $final_line = $prefix . $line . $suffix; } elsif ( $opt->{'empty'} && $opt->{'empty'} eq 'blank' ) { $final_line = ''; } elsif ( $opt->{'empty'} && $opt->{'empty'} eq 'undefined' ) { $final_line = undef; } else { next; }
my $empty = $opt->{empty} || ''; ... if ( length($line) || $empty eq 'fill' ) { $final_line = $prefix . $line . $suffix; } elsif ( $empty eq 'blank' ) { $final_line = ''; } elsif ( $empty eq 'undefined' ) { $final_line = undef; } else { next; }
But I'd personally setup some variables beforehand.
my $empty = $opt->{empty} || ''; my $trim_empty = !$empty; my $keep_empty = $empty eq 'fill'; my $empty_replacement = $empty eq 'blank' ? '' : undef; ... if ( length($line) || $keep_empty ) { push @array, $prefix . $line . $suffix; } elsif ( !$trim_empty ) { push @array, $empty_replacement; }
In reply to Re: What do I use to release a module to CPAN for the first time?
by ikegami
in thread What do I use to release a module to CPAN for the first time?
by Lady_Aleena
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |