]> git.vpit.fr Git - perl/modules/Linux-SysInfo.git/commitdiff
Importing Linux-SysInfo-0.04.tar.gz v0.04
authorVincent Pit <vince@profvince.com>
Sun, 29 Jun 2008 16:41:24 +0000 (18:41 +0200)
committerVincent Pit <vince@profvince.com>
Sun, 29 Jun 2008 16:41:24 +0000 (18:41 +0200)
Changes
MANIFEST
META.yml
Makefile.PL
README
SysInfo.xs
lib/Linux/SysInfo.pm
samples/sysinfo.pl [new file with mode: 0755]
t/20-extended.t

diff --git a/Changes b/Changes
index 65ca78c6320bf52bce99fdad17f388ba84d5f0c4..5665e24030bc7c0a22e8bda5ea19953c04826558 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,11 @@
 Revision history for Linux-SysInfo
 
 Revision history for Linux-SysInfo
 
+0.04   2007-05-03 09:35 UTC
+       + Add : The samples/sysinfo.pl sample script.
+       + Chg : Declare LS_HAS_EXTENDED with newCONSTSUB.
+       + Fix : Missing LICENSE in Makefile.PL
+       + Fix : Skipping extended tests will now display the good reason.
+
 0.03   2007-04-18 10:25 UTC
        + Fix : Load average raw values have to be shifted on a platform
                dependant way. They are now correctly reported.
 0.03   2007-04-18 10:25 UTC
        + Fix : Load average raw values have to be shifted on a platform
                dependant way. They are now correctly reported.
index 03999d1c6f356f8ecb168361451d5c2f175f4746..ad30d7388b471b388f9774ae492bfbcbdd94c77c 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -5,6 +5,7 @@ Makefile.PL
 README
 SysInfo.xs
 lib/Linux/SysInfo.pm
 README
 SysInfo.xs
 lib/Linux/SysInfo.pm
+samples/sysinfo.pl
 t/00-load.t
 t/10-standard.t
 t/20-extended.t
 t/00-load.t
 t/10-standard.t
 t/20-extended.t
index 8d262a325eab4c8188d20fc0d098d92ab67b0bdb..6dd7092803a970e7b8eaee46d0f32588420de709 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -1,8 +1,8 @@
 --- #YAML:1.0
 name:                Linux-SysInfo
 --- #YAML:1.0
 name:                Linux-SysInfo
-version:             0.03
+version:             0.04
 abstract:            Perl interface to the sysinfo(2) Linux system call.
 abstract:            Perl interface to the sysinfo(2) Linux system call.
-license:             ~
+license:             perl
 generated_by:        ExtUtils::MakeMaker version 6.32
 distribution_type:   module
 requires:     
 generated_by:        ExtUtils::MakeMaker version 6.32
 distribution_type:   module
 requires:     
index 708db536e93073299df0e0788f139da65788b8a1..979d78b85911cc14430a393d71ca29d6f820ec1a 100644 (file)
@@ -5,6 +5,7 @@ use ExtUtils::MakeMaker;
 WriteMakefile(
     NAME                => 'Linux::SysInfo',
     AUTHOR              => 'Vincent Pit <perl@profvince.com>',
 WriteMakefile(
     NAME                => 'Linux::SysInfo',
     AUTHOR              => 'Vincent Pit <perl@profvince.com>',
+    LICENSE             => 'perl',
     VERSION_FROM        => 'lib/Linux/SysInfo.pm',
     ABSTRACT_FROM       => 'lib/Linux/SysInfo.pm',
     PL_FILES            => {},
     VERSION_FROM        => 'lib/Linux/SysInfo.pm',
     ABSTRACT_FROM       => 'lib/Linux/SysInfo.pm',
     PL_FILES            => {},
diff --git a/README b/README
index 8bca0c2b27ce9cc05f8a2f0b6fef90edaffafebd..c138c40eb9cf14a066b16f0337dbe8852da1552e 100644 (file)
--- a/README
+++ b/README
@@ -2,7 +2,7 @@ NAME
     Linux::SysInfo - Perl interface to the sysinfo(2) Linux system call.
 
 VERSION
     Linux::SysInfo - Perl interface to the sysinfo(2) Linux system call.
 
 VERSION
-    Version 0.03
+    Version 0.04
 
 SYNOPSIS
         use Linux::SysInfo qw/sysinfo/;
 
 SYNOPSIS
         use Linux::SysInfo qw/sysinfo/;
index 7017009371b5bb0a91fc7b06b4e04531a2626900..f7509c419a4edf65d0d1bc7bd95394a1dbc80535 100644 (file)
@@ -43,6 +43,10 @@ PROTOTYPES: ENABLE
 
 BOOT:
 {
 
 BOOT:
 {
+ HV *stash;
+ stash = gv_stashpv("Linux::SysInfo", TRUE);
+ newCONSTSUB(stash, "LS_HAS_EXTENDED", newSViv(SYSINFO_EXTENDED));
+
  SYSINFO_KEY_SET_HASH(key_uptime);
  SYSINFO_KEY_SET_HASH(key_load1);
  SYSINFO_KEY_SET_HASH(key_load5);
  SYSINFO_KEY_SET_HASH(key_uptime);
  SYSINFO_KEY_SET_HASH(key_load1);
  SYSINFO_KEY_SET_HASH(key_load5);
@@ -66,7 +70,7 @@ sysinfo()
 PREINIT:
  struct sysinfo si;
  NV l;
 PREINIT:
  struct sysinfo si;
  NV l;
- HVh;
+ HV *h;
 CODE:
  if (sysinfo(&si) == -1) {
   XSRETURN_UNDEF;
 CODE:
  if (sysinfo(&si) == -1) {
   XSRETURN_UNDEF;
@@ -100,9 +104,3 @@ CODE:
 OUTPUT:
  RETVAL
 
 OUTPUT:
  RETVAL
 
-SV *
-LS_HAS_EXTENDED()
-CODE:
- RETVAL = newSViv(SYSINFO_EXTENDED); /* mortalized in RETVAL */
-OUTPUT:
- RETVAL
index c1e602dab548d8415093a74b312a32816e9918a3..974664672e6412c302a3aa9fdb54f8d8551b2ba9 100644 (file)
@@ -9,11 +9,11 @@ Linux::SysInfo - Perl interface to the sysinfo(2) Linux system call.
 
 =head1 VERSION
 
 
 =head1 VERSION
 
-Version 0.03
+Version 0.04
 
 =cut
 
 
 =cut
 
-our $VERSION = '0.03';
+our $VERSION = '0.04';
 
 =head1 SYNOPSIS
 
 
 =head1 SYNOPSIS
 
diff --git a/samples/sysinfo.pl b/samples/sysinfo.pl
new file mode 100755 (executable)
index 0000000..2ca2f90
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/env perl
+
+use strict;
+use warnings;
+
+use Linux::SysInfo qw/sysinfo LS_HAS_EXTENDED/;
+
+my $si = sysinfo;
+die 'sysinfo() failed ! (should be pretty rare but it did happen)' unless $si;
+
+print 'Extended fields are ', (LS_HAS_EXTENDED ? '' : 'NOT '), "available on your system.\n\n";
+
+print "Values :\n";
+print "- $_: $si->{$_}\n" for sort keys %$si;
+
+if (LS_HAS_EXTENDED) {
+ print "\n";
+ print 'You have the mem_unit field set to ', $si->{mem_unit}, ', hence ',
+ ($si->{mem_unit} == 1) ? "the memory values are the actual sizes in bytes :\n"
+                        : "the sizes in bytes are actually :\n";
+ print '- ', $_, ': ', $si->{$_} * $si->{mem_unit}, "\n" for sort
+ qw/totalram freeram sharedram bufferram totalswap freeswap totalhigh freehigh/;
+}
index c54751e2c4c8f4d104965c100185725a38298c7f..28806a4884a806e62a3995f2d5a8378b6631b307 100644 (file)
@@ -1,12 +1,13 @@
 #!perl -T
 
 #!perl -T
 
-use Test::More tests => 4;
+use Test::More;
 
 use Linux::SysInfo qw/sysinfo LS_HAS_EXTENDED/;
 
 
 use Linux::SysInfo qw/sysinfo LS_HAS_EXTENDED/;
 
-SKIP:
-{
- skip 'Your kernel does not support extended sysinfo fields', 4 unless LS_HAS_EXTENDED;
+unless (LS_HAS_EXTENDED) {
+ plan skip_all => 'your kernel does not support extended sysinfo fields';
+} else {
+ plan tests => 4;
 
  my $si = sysinfo;
  ok(defined $si);
 
  my $si = sysinfo;
  ok(defined $si);