File Coverage

blib/lib/Linux/Perl/uname.pm
Criterion Covered Total %
statement 23 23 100.0
branch 2 2 100.0
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 31 32 96.8


line stmt bran cond sub pod time code
1             package Linux::Perl::uname;
2              
3             =encoding utf-8
4              
5             =head1 NAME
6              
7             Linux::Perl::uname
8              
9             =head1 SYNOPSIS
10              
11             my @parts = Linux::Perl::uname->uname();
12              
13             my @parts = Linux::Perl::uname::x86_64->uname();
14              
15             =head1 DESCRIPTION
16              
17             This module returns the list of strings from the C system call.
18             See C for the specifics of what that means.
19              
20             =cut
21              
22 3     3   117510 use strict;
  3         6  
  3         69  
23 3     3   12 use warnings;
  3         3  
  3         66  
24              
25 3     3   1032 use Call::Context;
  3         615  
  3         69  
26 3     3   951 use Linux::Perl;
  3         6  
  3         81  
27              
28 3     3   15 use constant BUFFER_SIZE => 257 * 6;
  3         3  
  3         468  
29              
30             sub uname {
31 2     2 0 203735 my ($class) = @_;
32              
33 2         58 Call::Context::must_be_list();
34              
35 2 100       84 if (!$class->can('NR_uname')) {
36 1         1289 require Linux::Perl::ArchLoader;
37 1         30 $class = Linux::Perl::ArchLoader::get_arch_module($class);
38             }
39              
40 2         12 my $buf = ("\0" x BUFFER_SIZE);
41 2         51 Linux::Perl::call( $class->NR_uname(), $buf );
42              
43 2         38 return split m<\0+>, $buf;
44             }
45              
46             1;