如何将数组放入 POE 堆并推送或弹出数据?
如何将数组放在 POE 堆上,并向其中推送/弹出数据?
我试图将以下数组放在堆上:
@commands = (
["quit",\&Harlie::Commands::do_quit,10],
["part",\&Harlie::Commands::do_part,10],
["join",\&Harlie::Commands::do_join,10],
["nick",\&Harlie::Commands::do_nick,10],
["module",\&Harlie::Commands::do_modules,10],
["uptime",\&Harlie::Commands::do_uptime,0]
);
我如何才能访问其中包含的函数引用?目前,我可以通过以下方式运行它们:
@commands->[$foo]->(@bar);
我的假设是否正确?:
$heap->{commands}->[$foo]->(@bar);
How do I put an array on the POE heap, and push/pop data to/from it?
I'm trying to put the following array on the heap:
@commands = (
["quit",\&Harlie::Commands::do_quit,10],
["part",\&Harlie::Commands::do_part,10],
["join",\&Harlie::Commands::do_join,10],
["nick",\&Harlie::Commands::do_nick,10],
["module",\&Harlie::Commands::do_modules,10],
["uptime",\&Harlie::Commands::do_uptime,0]
);
And how would I be able to access the function references contained within? Currently, I can run them via:
@commands->[$foo]->(@bar);
Would I be correct in assuming it would simply be?:
$heap->{commands}->[$foo]->(@bar);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要在 POE 堆上创建/使用数组,只需将引用包装在“@{...}”中即可。
例如:
然而,数组的数组不那么简单。逻辑上遵循上述内容的程序...
...仅给出以下错误。
To create/use an array on the POE heap, it's merely a case of wrapping the reference in "@{...}".
e.g.:
However, arrays of arrays are not that simple. The program that logically follows on from the above...
...merely gives the following error.