File Coverage

blib/lib/Alien/Rust.pm
Criterion Covered Total %
statement 15 15 100.0
branch 2 4 50.0
condition n/a
subroutine 6 6 100.0
pod 2 2 100.0
total 25 27 92.5


line stmt bran cond sub pod time code
1             package Alien::Rust;
2             $Alien::Rust::VERSION = '0.03';
3 1     1   306576 use strict;
  1         9  
  1         30  
4 1     1   7 use warnings;
  1         2  
  1         27  
5 1     1   6 use base qw( Alien::Base );
  1         1  
  1         1068  
6 1     1   5793 use 5.008004;
  1         3  
7              
8             sub needs_rustup_home {
9 1     1 1 1665968 my ($class) = @_;
10             exists $class->runtime_prop->{'_using_rustup'}
11 1 50       8 ? $class->runtime_prop->{'_using_rustup'}
12             : 0;
13             }
14              
15             sub rustup_home {
16 1     1 1 25 my ($class) = @_;
17 1 50       4 $class->runtime_prop->{'rustup_home'} || '';
18             }
19              
20             1;
21              
22             =head1 NAME
23              
24             Alien::Rust - Find or build Rust
25              
26             =head1 SYNOPSIS
27              
28             Command line tool:
29              
30             use Alien::Rust;
31             use Env qw( @PATH $RUSTUP_HOME );
32              
33             unshift @PATH, Alien::Rust->bin_dir;
34             $RUSTUP_HOME = Alien::Rust->rustup_home if Alien::Rust->needs_rustup_home;
35              
36             =head1 DESCRIPTION
37              
38             This distribution provides Rust so that it can be used by other
39             Perl distributions that are on CPAN. It does this by first trying to
40             detect an existing install of Rust on your system. If found it
41             will use that. If it cannot be found, the source code will be downloaded
42             from the internet and it will be installed in a private share location
43             for the use of other modules.
44              
45             =head1 METHODS
46              
47             =head2 rustup_home
48              
49             Returns the value for the environment variable C. This is valid only
50             if L returns true.
51              
52             Without this value, certain Rust configurations that use
53             L|https://rust-lang.github.io/rustup/> will not work as their
54             binaries (e.g., C, C, etc.) are shims that point to the toolchain
55             managed by C.
56              
57             =head2 needs_rustup_home
58              
59             Returns true if the value returned by L must be set. See
60             L for more information.
61              
62             =head1 SEE ALSO
63              
64             =over 4
65              
66             =item L
67              
68             Documentation on the Alien concept itself.
69              
70             =item L
71              
72             The base class for this Alien.
73              
74             =item L
75              
76             Detailed manual for users of Alien classes.
77              
78             =back
79              
80             =cut