我是一名非程序员,他们希望从我们的InfoBlox DHCP框中检索有用的信息。我已经安装了Perl API并且可以使用它。
我有一个来自Data :: Dumper“thingie”的输出,似乎有我想要的一些信息。我想直接引用一些数据,但我不确定如何。
print Dumper(\ $ object)
以下是Data :: Dumper输出的一部分;
$VAR1 = \bless( {
'network' => '10.183.1.0/24',
'override_lease_scavenge_time' => 'false',
'enable_ifmap_publishing' => 'false',
'low_water_mark_reset' => '10',
'use_lease_time' => 0,
'use_enable_option81' => 0,
'network_container' => '/',
'override_ddns_ttl' => 'false',
'rir' => 'NONE',
'network_view' => bless( {
<snip> --------------------------------------
'extattrs' => {
'Use' => bless( {
'value' => 'Voip'
}, 'Infoblox::Grid::Extattr' )
},
<snip> --------------------------------------
'members' => [
bless( {
'ipv4addr' => '10.85.9.242',
'name' => 'ig3-app3.my.net'
}, 'Infoblox::DHCP::Member' ),
bless( {
'ipv4addr' => '10.85.9.210',
'name' => 'ig3-app1.my.net'
}, 'Infoblox::DHCP::Member' ),
bless( {
'ipv4addr' => '10.85.9.226',
'name' => 'ig3-app2.my.net'
}, 'Infoblox::DHCP::Member' )
],
'override_ignore_client_identifier' => 'false',
'email_list' => undef,
'rir_registration_status' => '??
}, 'Infoblox::DHCP::Network' );
如何查看元素?即...
print $object{members->name};
print $object{members->ipv4addr};
print $object{extattrs->Use->value};
我发现API dox不具备我的技能水平:)我想提取的数据仍然遥不可及。
my @retrieved_objs = $session->search (
object => "Infoblox::DHCP::Network",
network => '.*\.*\.*\..*',
);
foreach $object ( @retrieved_objs ) {
my $network = $object->network;
my $comment = $object->comment;
my $extattrs = $object->extattrs;
my $options = $object->options;
print $network, " network ", $comment, " ", $extattrs, " ", $options, "\n";
}
--------输出---
10.183.2.0/24网络HASH(0x6a2f038)ARRAY(0x1d20eb0)
10.192.1.0/24网络HASH(0x9df6540)ARRAY(0x9df5468)
10.192.2.0/24网络HASH(0xa088fc8)ARRAY(0xa089718)