Linux-Sysfs

 view release on metacpan or  search on metacpan

t/common.pl  view on Meta::CPAN

sub show_driver {
    my ($drv) = @_;

    if (blessed $drv && $drv->isa('Linux::Sysfs::Driver')) {
        debug(sprintf 'Driver is "%s" at "%s"', $drv->name, $drv->path);
    }
}

sub show_driver_list {
    my ($drivers) = @_;

    for my $drv (@{ $drivers || [] }) {
        show_driver($drv);
    }
}

sub show_class_device {
    my ($classdev) = @_;

    if (blessed $classdev && $classdev->isa('Linux::Sysfs::ClassDevice')) {
        debug(sprintf 'Class device "%s" belongs to the "%s" class', $classdev->name, $classdev->classname);
    }
}

sub show_module {
    my ($module) = @_;

    if (blessed $module && $module->isa('Linux::Sysfs::Module')) {
        debug(sprintf 'Module name is %s, path is %s', $module->name, $module->path);
        show_attribute_list([$module->get_attributes]);
        show_parm_list([$module->get_parms]);
        show_section_list([$module->get_sections]);
    }
}

sub show_parm_list {
    my ($parms) = @_;

    for my $parm (@{ $parms || [] }) {
        debug($parm->name);
    }
}

sub show_section_list {
    my ($sections) = @_;

    for my $sect (@{ $sections || [] }) {
        debug($sect->name);
    }
}

package Where::The::Hell::Is::It::Documented::That::I::Can't::Export::Symbols::To::main::From::main::Questionmark;
# After trying to use the same piece of code without the above package statement
# I concluded it was a perl bug. I digged into the perl sources and found out
# that SVs (and other variables) are only marked as being imported (and therefor
# strict clean) if CopSTASH_ne(PL_curcop, GvSTASH(dest)), where dest is the SV
# to be copied to returns true. This is the case when the current control ops
# (PL_curcop) namespace doesn't match the namespace of the destination SV..
# See sv.c line 3776 (5.8.8).

my $conf = require 't/config.pl';

my $caller = (caller())[0];
while (my ($key, $val) = each(%{ $conf })) {
    no strict 'refs';
    *{ "${caller}::${key}" } = \$val;
}

1;



( run in 0.613 second using v1.01-cache-2.11-cpan-39bf76dae61 )