Perl需要比较两个数据结构和返回差异 [英] Perl Need to Compare Two Data Structures and Return Differences

查看:88
本文介绍了Perl需要比较两个数据结构和返回差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个数据结构,混合了散列和数组。我如何比较两个数据结构并返回他们的差异,像perl的Test :: Harness模块​​,但我不想实际运行单元测试。 ...或者有没有一个方法来调试Test ::线束,而不实际运行单元测试?

I have two data structures with a mix of hashes and arrays. How can I compare the two data structures and return their differences, something like perl's Test::Harness module, but I don't want to actually run a unit test. ...or is there a way to tun Test::Harness without actually running a unit test?

推荐答案

Perl Monks 说, Test :: Deep Data :: Compare Data :: Match 是您的朋友。这些包似乎并不适合产生详细的差异,但你可能能够在回调中跟踪精确的差异。

Perl Monks says that Test::Deep, Data::Compare, and Data::Match are your friends. Those packages don't seem to be geared towards producing detailed diffs but you might be able to hack in a callback to keep track of the precise differences.

这篇关于Perl需要比较两个数据结构和返回差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆