The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Linux::Sysfs::ClassDevice - sysfs class devices

SYNOPSIS

    my $classdev = Linux::Sysfs::ClassDevice->open($name);

        my $parent = $classdev->get_parent;
        my $device = $classdev->get_device;

    $classdev->close;

DESCRIPTION

Libsysfs provides functions to open sysfs class devices.

METHODS

open
    my $classdev = Linux::Sysfs::ClassDevice->open($name);

Given the $name of the class on which to look for, this method locates a given class device and returns a Linux::Sysfs::ClassDevice instance corresponding to the requested class device.

open_path
    my $classdev = Linux::Sysfs::ClassDevice->open_path($path);

Given the $path to the class device file, this method opens up one of the class devices represented in /sys/class/$class. It returns a Linux::Sysfs::ClassDevice instance on success or undef on failure.

close
    $classdev->close;

Closes up the class device.

get_parent
    my $parent = $classdev->get_parent;

Returns a Linux::Sysfs::ClassDevice instance for the parent of the given class device.

get_attr
get_attribute
    my $attr = $classdev->get_attribute($name);

Searches supplied class device's attributes by $name and returns the Linux::Sysfs::Attribute instance for it.

get_attrs
get_attributes
    my @attrs = $classdev->get_attributes;

Returns a list of Linux::Sysfs::Attribute instances for the given class device.

get_device
    my $device = $classdev->get_device;

Returns the Linux::Sysfs::Device instance (if present) for the given class device.

name
    my $name = $classdev->name;

Returns the class device's name.

path
    my $path = $classdev->path;

Returns the full path to the class device in sysfs.

classname
    my $path = $classdev->classname;

Returns the name of the class $classdev belongs to.

AUTHOR

Florian Ragwitz <rafl@debian.org>

COPYRIGHT & LICENSE

Copyright 2006 Florian Ragwitz, all rights reserved.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA.