瀏覽代碼

Updated regex to get disk temperature to look for two different lines that could contain temp
Corrected get_disk_attributes() to return hash correctly on Perl < 5.14

Paul Trost 11 年之前
父節點
當前提交
188dc2f235
共有 5 個文件被更改,包括 18 次插入8 次删除
  1. 4 0
      Changes
  2. 9 5
      Makefile.PL
  3. 二進制
      dist/Disk-SMART-0.10.tar.gz
  4. 2 2
      lib/Disk/SMART.pm
  5. 3 1
      t/01-function_tests.t

+ 4 - 0
Changes

@@ -1,5 +1,9 @@
 Revision history for Disk-SMART
 Revision history for Disk-SMART
 
 
+0.10	2014-10-18
+	Updated regex to get disk temperature to look for two different lines that could contain temp
+	Corrected get_disk_attributes() to return hash correctly on Perl < 5.14
+
 0.09    2014-10-17 
 0.09    2014-10-17 
         Minor changes to get unit tests to pass on smokers
         Minor changes to get unit tests to pass on smokers
         Added testing of env parameter for smartctl path, which will enable multi OS support
         Added testing of env parameter for smartctl path, which will enable multi OS support

+ 9 - 5
Makefile.PL

@@ -10,9 +10,11 @@ WriteMakefile(
     MIN_PERL_VERSION => '5.010',
     MIN_PERL_VERSION => '5.010',
     ABSTRACT_FROM    => 'lib/Disk/SMART.pm',
     ABSTRACT_FROM    => 'lib/Disk/SMART.pm',
     PL_FILES         => {},
     PL_FILES         => {},
-    TEST_REQUIRES    => {
-        'Test::More'  => 0,
-        'Test::Fatal' => 0,
+    TEST_REQUIRES => {
+        'Test::More'          => 0,
+        'Test::Fatal'         => 0,
+        'Test::Pod'           => 0,
+        'Test::Pod::Coverage' => 0,
     },
     },
     PREREQ_PM => {
     PREREQ_PM => {
         'Math::Round' => 0,
         'Math::Round' => 0,
@@ -40,8 +42,10 @@ WriteMakefile(
             },
             },
             test => {
             test => {
                 requires => {
                 requires => {
-                    'Test::More'  => 0,
-                    'Test::Fatal' => 0,
+                    'Test::More'          => 0,
+                    'Test::Fatal'         => 0,
+                    'Test::Pod'           => 0,
+                    'Test::Pod::Coverage' => 0,
                 }
                 }
             }
             }
         }
         }

二進制
dist/Disk-SMART-0.10.tar.gz


+ 2 - 2
lib/Disk/SMART.pm

@@ -6,7 +6,7 @@ use Carp;
 use Math::Round;
 use Math::Round;
 
 
 {
 {
-    $Disk::SMART::VERSION = '0.09'
+    $Disk::SMART::VERSION = '0.10'
 }
 }
 
 
 our $smartctl = qx(which smartctl);
 our $smartctl = qx(which smartctl);
@@ -71,7 +71,7 @@ sub get_disk_attributes {
     my ( $self, $device ) = @_;
     my ( $self, $device ) = @_;
     $self->_validate_param($device);
     $self->_validate_param($device);
 
 
-    return $self->{'devices'}->{$device}->{'attributes'};
+    return %{ $self->{'devices'}->{$device}->{'attributes'} };
 }
 }
 
 
 
 

+ 3 - 1
t/01-function_tests.t

@@ -108,7 +108,9 @@ is( $smart->get_disk_temp($disk), 2, 'get_disk_temp() returns device temperature
 is( $smart->get_disk_health($disk), 'PASSED', 'get_disk_health() returns health status' );
 is( $smart->get_disk_health($disk), 'PASSED', 'get_disk_health() returns health status' );
 is( $smart->get_disk_model($disk), 'ST3250410AS', 'get_disk_model() returns device model' );
 is( $smart->get_disk_model($disk), 'ST3250410AS', 'get_disk_model() returns device model' );
 is( $smart->get_disk_errors($disk), 'No Errors Logged', 'get_disk_errors() returns proper string' );
 is( $smart->get_disk_errors($disk), 'No Errors Logged', 'get_disk_errors() returns proper string' );
-is( scalar( keys $smart->get_disk_attributes($disk) ), 18, 'get_disk_attributes() returns hash of device attributes' );
+
+my %attribs = $smart->get_disk_attributes($disk);
+is( keys %attribs, 18, 'get_disk_attributes() returns hash of device attributes' );
 is( $smart->run_short_test($disk), 'Completed without error', 'run_short_test() returns proper string' );
 is( $smart->run_short_test($disk), 'Completed without error', 'run_short_test() returns proper string' );
 
 
 $ENV{'MOCK_TEST_DATA'} =~ s/ST3250410AS//;
 $ENV{'MOCK_TEST_DATA'} =~ s/ST3250410AS//;