get 方法:
[root@wx03 zook]# cat a4.pl
use ZooKeeper;
use AnyEvent;
use AE;
use Data::Dumper;
my $zk = ZooKeeper->new(hosts => '127.0.0.1:2181');
my $stat = $zk->exists('/zk/child600');
if ($stat){
$zk->delete('/zk/child600');
}
my $created_path = $zk->create('/zk/child600', 'child600',
ephemeral => 1,
sequential => 1,
'acl' => ZOO_OPEN_ACL_UNSAFE);
###获取数据
my ($data,$stat)=$zk->get('/zk');
print $data;
[root@wx03 zook]# perl a4.pl
Odd number of elements in hash assignment at /usr/local/perl/lib/site_perl/5.22.1/x86_64-linux/ZooKeeper.pm line 392.
myData[root@wx03 zook]# get_child 方法: my $zk = ZooKeeper->new(hosts => '127.0.0.1:2181');
my $stat = $zk->exists('/zk/child600');
if ($stat){
$zk->delete('/zk/child600');
}
my $created_path = $zk->create('/zk/child600', 'child600',
ephemeral => 1,
sequential => 1,
'acl' => ZOO_OPEN_ACL_UNSAFE);
###获取数据
my (@data,$stat)=$zk->get_children('/zk');
foreach (@data){
print "\$_ is $_\n";
};
[root@wx03 zook]# perl a4.pl
Odd number of elements in hash assignment at /usr/local/perl/lib/site_perl/5.22.1/x86_64-linux/ZooKeeper.pm line 392.
$_ is child500
$_ is child700
$_ is child600
$_ is test
$_ is child300
$_ is child1
$_ is child200 获取child 子节点的值:
[root@wx03 zook]# cat a4.pl
use ZooKeeper;
use AnyEvent;
use AE;
use Data::Dumper;
my $zk = ZooKeeper->new(hosts => '127.0.0.1:2181');
my $stat = $zk->exists('/zk/child600');
if ($stat){
$zk->delete('/zk/child600');
}
my $created_path = $zk->create('/zk/child600', 'child600',
ephemeral => 1,
sequential => 1,
'acl' => ZOO_OPEN_ACL_UNSAFE);
###获取数据
my (@data,$stat)=$zk->get_children('/zk');
foreach (@data){
print "\$_ is $_\n";
print $zk->get("/zk/$_");
print "\n";
};
[root@wx03 zook]# perl a4.pl
Odd number of elements in hash assignment at /usr/local/perl/lib/site_perl/5.22.1/x86_64-linux/ZooKeeper.pm line 392.
$_ is test2
d4rwrHASH(0x14d0e28)
$_ is child600
HASH(0x14e5f38)
$_ is test
aaaHASH(0x14e5f38)
$_ is test1
dadadHASH(0x14e5f38)

get get_children方法的更多相关文章

  1. SAP CRM 树视图(TREE VIEW)

    树视图可以用于表示数据的层次. 例如:SAP CRM中的组织结构数据可以表示为树视图. 在SAP CRM Web UI的术语当中,没有像表视图(table view)或者表单视图(form view) ...

  2. 【JSTREE】 复选框默认选中【总结】

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"% ...

  3. 使用MSHTML解析HTML页面

    最近在写一个爬虫项目,本来打算用C/C++来实现,在网上查找有关资料的时候发现了微软的这个MSHTML库,最后发现在解析动态页面的时候它的表现实在是太差:在项目中需要像浏览器那样,执行JavaScri ...

  4. WEB UI做TREE

    效果图: 原本的普通搜索帮助,改成上面这样层级的搜索帮助.这里只做了两级. 一,新建一个TREE节点 1.新建tree结构:ZGRTEXT 2.新建树叶节点处理类: 修改超类为CL_BSP_WD_TR ...

  5. javaSE27天复习总结

    JAVA学习总结    2 第一天    2 1:计算机概述(了解)    2 (1)计算机    2 (2)计算机硬件    2 (3)计算机软件    2 (4)软件开发(理解)    2 (5) ...

  6. wordpress---wp_query的使用方法

    wp_query是一个wordpress用于复杂请求的的一个类,看到query懂开发的人就会反应这个是数据库查询的一个类,这个类可谓是非常有用的,可以帮助我们做很多复杂的查询. wp_query的使用 ...

  7. 解决U3D4.1.5或以上无法启动MONODEV的方法

    通常会报这样的错误 System.EntryPointNotFoundException: Unable to find an entry point named 'gtksharp_list_get ...

  8. mapreduce多文件输出的两方法

    mapreduce多文件输出的两方法   package duogemap;   import java.io.IOException;   import org.apache.hadoop.conf ...

  9. 【.net 深呼吸】细说CodeDom(6):方法参数

    本文老周就给大伙伴们介绍一下方法参数代码的生成. 在开始之前,先补充一下上一篇烂文的内容.在上一篇文章中,老周检讨了 MemberAttributes 枚举的用法,老周此前误以为该枚举不能进行按位操作 ...

随机推荐

  1. C#共享内存类改进版

    原文 C#共享内存类改进版 改进说明及源码实例下载见:http://blog.csdn.net/zzh8845/archive/2008/11/22/3349963.aspx ShareMem.cs ...

  2. Nginx CORS实现JS跨域

    1. 什么是跨域 简单地理解就是因为JavaScript同源策略的限制,a.com 域名下的js无法操作b.com或是c.a.com域名下的对象. 同源是指相同的协议.域名.端口.特别注意两点: 如果 ...

  3. 导出Ext.grid.Panel到excel

    1.客户端定义,基本的想法是form提交表格头定义,数据,以json方式传输 Ext.grid.Panel.addMembers({ exportExcel:function(options){ if ...

  4. projecteuler----&gt;problem=8----Largest product in a series

    title: The four adjacent digits in the 1000-digit number that have the greatest product are 9 9 8 9 ...

  5. 如何自定义iOS中的控件

    本文译自 How to build a custom control in iOS .大家要是有什么问题,可以直接在 twitter 上联系原作者,当然也可以在最后的评论中回复我. 在开发过程中,有时 ...

  6. iOS开发 点击跳转到App Store 或者 点击按钮去评价

    //跳转到应用页面 NSString *str = [NSString stringWithFormat:@"http://itunes.apple.com/us/app/id%d" ...

  7. C++之对象存储空间_对象模型

    C++编译器如何完成面向对象理论向计算机程序的转化 #include<stdio.h>//////c++对象模型和结构体一样         class Test            { ...

  8. json所需jar包 & js解析后台json数据

    Json 所需jar包: var listxxx='<%=request.getAttribute("listxxx")%>';  // list数组 var mapx ...

  9. 重新生成IE02

    procedure ReBuild_IE02( pi_aac001 in number, po_fhz out varchar2, po_msg out varchar2) is type typ_t ...

  10. 纯css画哆啦A梦

    今天有点无聊,照着网上的图写了个哆啦A梦,无技术可言,纯考耐心. <!doctype html> <html lang="en"> <head> ...