有没有比Perl的Data :: Dumper更为冗长的替代方案? [英] Is there a less verbose alternative to Perl's Data::Dumper?
问题描述
我正在尝试打印一些解析树,而Data::Dumper
对此非常冗长,例如打印:
I'm trying to print some parse trees, and Data::Dumper
is very verbose for that, for example printing:
{
'A' => {
'ID' => 'y'
},
'OP' => '=',
'B' => {
'NUM' => '5'
}
},
而不是说:
{
'A' => {'ID' => 'y'},
'OP' => '=',
'B' => {'NUM' => '5'}
},
而且很难读,因为它需要大量的行.
and it's very hard to read since it take massive number of lines.
是否有任何Perl库可以完成Data::Dumper
的工作,除了更简洁以外,还是我需要编写自己的库?
Is there any Perl library which does what Data::Dumper
does except more tersely, or do I need to write my own?
推荐答案
您要 Data::Dump
:
历史
Data::Dump
模块从对Sarathy的沮丧中脱颖而出
在大多数情况下都是出色的Data::Dumper
.基本思想和一些代码是
与Sarathy的模块共享. Data::Dump
模块提供了很多功能
界面比Data::Dumper
更简单.
The Data::Dump
module grew out of frustration with Sarathy's
in-most-cases-excellent Data::Dumper
. Basic ideas and some code are
shared with Sarathy's module. The Data::Dump
module provides a much
simpler interface than Data::Dumper
.
Data::Printer
是一种具有彩色输出的更现代的替代方法.
Data::Printer
is a more modern alternative with colored output.
这篇关于有没有比Perl的Data :: Dumper更为冗长的替代方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!