cleared => '*',
pending => '!',
);
+my $SYMBOL = qr![^\s\d.,;:?\!\-+*/^&|=\<\>\[\]\(\)\{\}\@]+!;
sub _croak { require Carp; Carp::croak(@_) }
return "\"$str\"";
}
+sub _format_symbol {
+ my $self = shift;
+ my $str = shift;
+ return $self->_quote_string($str) if $str !~ /^${SYMBOL}$/;
+ return $str;
+}
+
sub _format_amount {
my $self = shift;
my $amount = shift;
$num .= $commodity->{dchar} . $fraction;
}
- my $symbol = $commodity->{symbol};
- $symbol = $self->_quote_string($symbol) if $symbol =~ /[0-9\s]/;
-
+ my $symbol = $self->_format_symbol($commodity->{symbol});
$num = $commodity->{syprf} ? "$symbol $num" : "$num $symbol";
return $num;