Acpi-Class

 view release on metacpan or  search on metacpan

lib/Acpi/Class/Attributes.pm  view on Meta::CPAN


	opendir (my $device, $dir)  or croak "The class/device '$dir' does not exist in your system. \n";
	my %attributes;
	while (readdir($device))
	{

		if (-f "$dir/$_")
		{
			my $content = do 
			{
				local @ARGV = "$dir/$_";
				local $/    = <ARGV>;
			};
			chomp $content if defined $content;
			$attributes{$_} = $content;
		}
	}
	return \%attributes;
}#}}}

1;

t/Acpi/Class.t  view on Meta::CPAN

	{
		last unless defined $_;
		$battery = $_ if ($_ =~ /BAT/);
	}
	closedir($device_dir);
	if (defined $battery) 
	{
		my $file = "$dir/$battery/technology";
		if (-f $file ) {
			my $content = do {
				local @ARGV = $file; 
				local $/    = <ARGV>;
			};
			$class->device($battery);
			my $bat_technology = $class->g_values->{'technology'};
			ok ( $bat_technology = $content, "Returned the correct value of $battery technology: $content");
		}
	}
	else
	{
		ok ( 1, "There is no BAT* file in folder $dir");



( run in 0.650 second using v1.01-cache-2.11-cpan-49f99fa48dc )