- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何在 Perl 中将受祝福的对象转换为 JSON?以下是我的数组:
@x = ({
'notificationtype' => 'TRAP',
'receivedfrom' => 'UDP: [10.127.34.212]:48909->[10.127.34.182]:162',
'version' => 1,
},
[
[
bless( {
'oidptr' => bless( do{\(my $o = '140059234062224)}, ''netsnmp_oidPtr' )
}, 'NetSNMP::OID' ),
'600',
67
],
[
bless( {
'oidptr' => bless( do{\(my $o = '140059236784112)}, ''netsnmp_oidPtr' )
}, 'NetSNMP::OID' ),
'OID: .iso.org.dod.internet.private.enterprises.14296.1.100.0.0.1',
6
]
]);
我可以使用 encode_json\@x
单独转换 $VAR1
,但是当我使用 blessed 对象时,它不起作用。我收到错误:
encountered object 'NetSNMP::OID=HASH(0x136b278)', but neither allow_blessed nor convert_blessed settings are enabled at u.pl line 256.
我需要一个序列化的 JSON 对象,以便我可以将它发送到服务器。
我该怎么做?
最佳答案
视情况而定,您想保留视觉效果吗?还是数据和层次结构?其他终端尺寸无法呈现相同的位置。我会只保留数据和层次结构。可能我会忽略焦点和事件。我会开始 umarating 像下面这样的属性,然后创建一个工厂这些是我为 Box 找到的那些
container.options
container.position,
container.getLines()
container.getText()
container.getContent
container.children
container.parent
container.style
container.type
container.visible
container.height
container.hidden
container.index
子类有行、数据、线等等……我不认为有一种机械的方法来做到这一点……
如果您想重新创建层次结构,您还需要迭代子项和父项,可能是整个树。
考虑一下,也许仅使用 this.options 就足够了, child 和 parent .. 好运会尝试同样的...
关于json - 祝福对象转换为 JSON,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43654409/
我是 Perl 新手,我一直在学习本教程 http://qntm.org/files/perl/perl.html 无论如何,我正在创建一个包含矩阵并执行各种基本操作(即高斯消除、rref、back
我正在使用 Blessed在终端中制作仪表板的库。 我正在将内容记录到日志小部件中,并希望使该小部件可滚动。使用下面的代码,滚动条出现了,但我实际上无法使用鼠标滚轮或拖动滚动条进行滚动。 var lo
我正在尝试 Python 脚本的一些光标图形输出,为我的应用程序提供一个漂亮的进度条。 我使用以下方法确保在显示输出之前我的屏幕是空白的。 print term.clear 但是当我的 Python
我是一名优秀的程序员,十分优秀!