Solaris::DeviceTree - Perl interface to the Solaris devicetree
use Solaris::DeviceTree
Construction and destruction:
$devtree = Solaris::DeviceTree->new $devtree = Solaris::DeviceTree->new( use => [ qw( libdevinfo path_to_inst filesystem ) ] ) $devtree->DESTROY
Tree traversal:
@children = $devtree->child_nodes @siblings = $devtree->sibling_nodes $node = $node->parent_node $root = $node->root_node
Methods concerning tree merging:
@sources = $node->sources
Data access methods:
$path = $node->devfs_path $instance = $devtree->instance $id = $node->nodeid @compat_names = $devtree->compatible_names ...
The Solaris::DeviceTree module implements the Solaris::DeviceTree::Node interface to access the Solaris device tree in a unified view from multiple data sources. The devicetree is presented as a hierarchical collection of nodes. The information is collected from the kernel via access to libdevinfo, the contents of the file /etc/path_to_inst and the filesystem entries below /dev and /devices. Each node contains the unified information from the data sources configured during object construction.
libdevinfo
/etc/path_to_inst
/dev
/devices
use Solaris::DeviceTree; my $t = Solaris::DeviceTree->new( use => [ qw( path_to_inst ) ] ); my @nodes = ( $t ); while( @nodes > 0 ) { my $node = shift @nodes; print $node->devfs_path, "\n"; unshift @nodes, $node->child_nodes; }
Copyright 1999-2003 Dagobert Michelsen.
Solaris::DeviceTree::PathToInst, Solaris::DeviceTree::Filesystem, Solaris::DeviceTree::Libdevinfo.
To install Solaris::DeviceTree::Libdevinfo::Impl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Solaris::DeviceTree::Libdevinfo::Impl
CPAN shell
perl -MCPAN -e shell install Solaris::DeviceTree::Libdevinfo::Impl
For more information on module installation, please visit the detailed CPAN module installation guide.