File Coverage

blib/lib/Linux/Unshare.pm
Criterion Covered Total %
statement 25 29 86.2
branch 3 6 50.0
condition n/a
subroutine 8 9 88.8
pod 0 1 0.0
total 36 45 80.0


line stmt bran cond sub pod time code
1             package Linux::Unshare;
2              
3 2     2   26164 use 5.010000;
  2         4  
4 2     2   10 use strict;
  2         2  
  2         36  
5 2     2   16 use warnings;
  2         6  
  2         38  
6 2     2   4 use Carp;
  2         2  
  2         106  
7              
8             require Exporter;
9 2     2   986 use AutoLoader;
  2         1942  
  2         8  
10              
11             our @ISA = qw(Exporter);
12              
13             # This allows declaration use Linux::Unshare ':all';
14             our %EXPORT_TAGS = ( 'clone' => [ qw(
15             CLONE_THREAD CLONE_FS CLONE_NEWNS CLONE_SIGHAND CLONE_VM CLONE_FILES CLONE_SYSVSEM
16             CLONE_CONTAINER CLONE_NEWNS CLONE_NEWUTS CLONE_NEWIPC CLONE_NEWNET CLONE_NEWPID
17             CLONE_NEWUSER CLONE_NEWCGROUP
18             ) ] );
19             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'clone'} }, qw(unshare unshare_ns) );
20             our @EXPORT = qw( );
21              
22             our $VERSION = '1.1';
23              
24             sub AUTOLOAD {
25 1     1   1799417 my $constname;
26 1         5 our $AUTOLOAD;
27 1         10 ($constname = $AUTOLOAD) =~ s/.*:://;
28 1 50       10 croak "&Linux::Unshare::constant not defined" if $constname eq 'constant';
29 1         16 my ($error, $val) = constant($constname);
30 1 50       6 if ($error) { croak $error; }
  1         276  
31             {
32 2     2   266 no strict 'refs';
  2         2  
  2         186  
  0         0  
33 0     0   0 *$AUTOLOAD = sub { $val };
  0         0  
34             }
35 0         0 goto &$AUTOLOAD;
36             }
37              
38             require XSLoader;
39             XSLoader::load('Linux::Unshare', $VERSION);
40              
41 1 50   1 0 720 sub unshare_ns { return unshare(0x20000) ? 0 : -1; }
42              
43             1;
44             __END__