File Coverage

blib/lib/Linux/Unshare.pm
Criterion Covered Total %
statement 26 30 86.6
branch 3 6 50.0
condition n/a
subroutine 8 9 88.8
pod 0 1 0.0
total 37 46 80.4


line stmt bran cond sub pod time code
1             package Linux::Unshare;
2              
3 2     2   94016 use 5.010000;
  2         8  
  2         100  
4 2     2   14 use strict;
  2         4  
  2         98  
5 2     2   12 use warnings;
  2         14  
  2         102  
6 2     2   14 use Carp;
  2         4  
  2         274  
7              
8             require Exporter;
9 2     2   1858 use AutoLoader;
  2         3204  
  2         14  
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 CLONE_NEWUSER
17             ) ] );
18             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'clone'} }, qw(unshare unshare_ns) );
19             our @EXPORT = qw( );
20              
21             our $VERSION = '0.05';
22              
23             sub AUTOLOAD {
24 1     1   394221 my $constname;
25 1         9 our $AUTOLOAD;
26 1         12 ($constname = $AUTOLOAD) =~ s/.*:://;
27 1 50       12 croak "&Linux::Unshare::constant not defined" if $constname eq 'constant';
28 1         139 my ($error, $val) = constant($constname);
29 1 50       7 if ($error) { croak $error; }
  1         3631  
30             {
31 2     2   524 no strict 'refs';
  2         4  
  2         300  
  0         0  
32 0     0   0 *$AUTOLOAD = sub { $val };
  0         0  
33             }
34 0         0 goto &$AUTOLOAD;
35             }
36              
37             require XSLoader;
38             XSLoader::load('Linux::Unshare', $VERSION);
39              
40 1 50   1 0 10044 sub unshare_ns { return unshare(0x20000) ? 0 : -1; }
41              
42             1;
43             __END__