| 1 | package CPANDB::Generator::GetIndex; | ||||||||||
| 2 | |||||||||||
| 3 | # This support class generates the CPAN::SQLite database into a particular | ||||||||||
| 4 | # directory. We need to do it outside the main process because it takes a | ||||||||||
| 5 | # bunch of locks (on Windows) which it doesn't release till the end of the | ||||||||||
| 6 | # process. | ||||||||||
| 7 | |||||||||||
| 8 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 2 | ▶ | use Carp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 2 | ▶ | use Process::Delegatable 0.26 (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 2 | ▶ | use Process::Storable 0.26 (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 2 | ▶ | use Process 0.26 (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 2 | ▶ | use CPAN::SQLite 0.197 (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 2 | ▶ | use vars qw{$VERSION @ISA @DELEGATE}; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 2 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.0
| |||||||||||
| 17 | 2 | $VERSION = '0.19'; | |||||||||
| 18 | 2 | @ISA = qw{ | |||||||||
| 19 | Process::Delegatable | ||||||||||
| 20 | Process::Storable | ||||||||||
| 21 | Process | ||||||||||
| 22 | }; | ||||||||||
| 23 | 2 | @DELEGATE = (); | |||||||||
| 24 | |||||||||||
| 25 | # Automatically handle delegation within the test suite | ||||||||||
| 26 | 2 | ▶ | if ( $ENV{HARNESS_ACTIVE} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 2 | require Probe::Perl; | |||||||||
| 28 | 2 | @DELEGATE = ( | |||||||||
| 29 | Probe::Perl->find_perl_interpreter, '-Mblib', | ||||||||||
| 30 | ); | ||||||||||
| 31 | } | ||||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | |||||||||||
| 35 | |||||||||||
| 36 | |||||||||||
| 37 | |||||||||||
| 38 | |||||||||||
| 39 | ##################################################################### | ||||||||||
| 40 | # Constructor and Accessors | ||||||||||
| 41 | |||||||||||
| 42 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 43 | 0 | my $class = shift; | |||||||||
| 44 | 0 | my $self = bless { @_ }, $class; | |||||||||
| 45 | 0 | return $self; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 0 | ▶ | sub cpan { | ||||||||
|
Subroutine
cpan: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 49 | 0 | $_[0]->{cpan}; | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 0 | ▶ | sub urllist { | ||||||||
|
Subroutine
urllist: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 53 | 0 | $_[0]->{urllist}; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | sub run { | ||||||||
|
Subroutine
run: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 57 | 0 | my $self = shift; | |||||||||
| 58 | |||||||||||
| 59 | 0 | ▶ | local $SIG{__WARN__} = sub { }; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 60 | 0 | my $sqlite = CPAN::SQLite->new( | |||||||||
| 61 | CPAN => $self->cpan, | ||||||||||
| 62 | db_dir => $self->cpan, | ||||||||||
| 63 | ); | ||||||||||
| 64 | 0 | ▶ | if ( $self->urllist ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 65 | 0 | $sqlite->{urllist} = $self->urllist; | |||||||||
| 66 | } | ||||||||||
| 67 | |||||||||||
| 68 | 0 | $sqlite->index( setup => 1 ); | |||||||||
| 69 | |||||||||||
| 70 | 0 | return 1; | |||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | 0 | ▶ | sub delegate { | ||||||||
|
Subroutine
delegate: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 74 | 0 | my $self = shift; | |||||||||
| 75 | 0 | ▶ | unless ( $self->{delegated} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 76 | 0 | $self->SUPER::delegate( @DELEGATE ); | |||||||||
| 77 | 0 | $self->{delegated} = 1; | |||||||||
| 78 | } | ||||||||||
| 79 | 0 | return 1; | |||||||||
| 80 | } | ||||||||||
| 81 | |||||||||||
| 82 | 0 | ▶ | sub delegated { | ||||||||
|
Subroutine
delegated: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 83 | 0 | $_[0]->{delegated}; | |||||||||
| 84 | } | ||||||||||
| 85 | |||||||||||
| 86 | 2 | 1; | |||||||||