| 1 | package Perl5::TestEachCommit::Util; | ||||||||||
| 2 | 1 | ▶ | use 5.014; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use Exporter 'import'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use File::Spec; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use File::Spec::Unix; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use Getopt::Long; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use locale; # make \w work right in non-ASCII lands | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | our $VERSION = 0.07; # Please keep in synch with lib/Perl5/TestEachCommit.pm | |||||||||
| 11 | 1 | $VERSION = eval $VERSION; | |||||||||
| 12 | 1 | our @EXPORT_OK = qw( process_command_line ); | |||||||||
| 13 | |||||||||||
| 14 | =head1 NAME | ||||||||||
| 15 | |||||||||||
| 16 | Perl5::TestEachCommit::Util - helper functions for Perl5::TestEachCommit | ||||||||||
| 17 | |||||||||||
| 18 | =head1 SUBROUTINES | ||||||||||
| 19 | |||||||||||
| 20 | =head2 C<process_command_line()> | ||||||||||
| 21 | |||||||||||
| 22 | Process command-line switches (options). Returns a reference to a hash. | ||||||||||
| 23 | |||||||||||
| 24 | B<Note:> This function is little more than a wrapper around | ||||||||||
| 25 | C<Getopt::Long::GetOptions()>. As such, it performs no evaluation of any | ||||||||||
| 26 | interactions among the various command-line switches. That evaluation is | ||||||||||
| 27 | deferred until C<Perl5::TestEachCommit::new() is called. | ||||||||||
| 28 | |||||||||||
| 29 | =cut | ||||||||||
| 30 | |||||||||||
| 31 | 3 | ▶ | sub process_command_line { | ||||||||
|
Subroutine
process_command_line: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 32 | 3 | local @ARGV = @ARGV; | |||||||||
| 33 | |||||||||||
| 34 | 3 | my %opts = map { $_ => '' } ( qw| | |||||||||
| 35 | workdir | ||||||||||
| 36 | branch | ||||||||||
| 37 | start | ||||||||||
| 38 | end | ||||||||||
| 39 | configure_command | ||||||||||
| 40 | make_test_prep_command | ||||||||||
| 41 | make_test_harness_command | ||||||||||
| 42 | skip_test_harness | ||||||||||
| 43 | verbose | ||||||||||
| 44 | make_minitest_prep_command | ||||||||||
| 45 | make_minitest_command | ||||||||||
| 46 | | ); | ||||||||||
| 47 | |||||||||||
| 48 | my $result = GetOptions( | ||||||||||
| 49 | "workdir=s" => \$opts{workdir}, | ||||||||||
| 50 | "branch=s" => \$opts{branch}, | ||||||||||
| 51 | "start=s" => \$opts{start}, | ||||||||||
| 52 | "end=s" => \$opts{end}, | ||||||||||
| 53 | "configure_command=s" => \$opts{configure_command}, | ||||||||||
| 54 | "make_test_prep_command=s" => \$opts{make_test_prep_command}, | ||||||||||
| 55 | "make_test_harness_command=s" => \$opts{make_test_harness_command}, | ||||||||||
| 56 | "skip_test_harness" => \$opts{skip_test_harness}, | ||||||||||
| 57 | "verbose" => \$opts{verbose}, | ||||||||||
| 58 | "make_minitest_prep_command=s" => \$opts{make_minitest_prep_command}, | ||||||||||
| 59 | "make_minitest_command=s" => \$opts{make_minitest_command}, | ||||||||||
| 60 | 3 | ▶ | ) or croak "Error in command line arguments"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | |||||||||||
| 62 | 3 | return \%opts; | |||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 1 | 1; | |||||||||
| 66 | |||||||||||