add to_string

pull/2077/head
Isaac 2018-01-21 21:11:05 +01:00
parent 62704601ca
commit fedd67a7f6
1 changed files with 7 additions and 0 deletions

View File

@ -430,6 +430,13 @@ sub transform {
return $value;
} # end sub transform
sub to_string {
my $type = ref($_[0]);
my $fields = eval '\%'.$type.'::fields';
return $type . ': '. join(' ' , map { $_[0]{$_} ? "$_ => $_[0]{$_}" : () } keys %$fields );
}
1;
__END__