| 1 | package Serge::Command::gendocs; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use parent Serge::Command; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use File::Basename; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use File::Find qw(find); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use File::Spec::Functions qw(rel2abs abs2rel catfile splitdir); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Serge::Pod; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | sub get_commands { | ||||||||||||||||||||||||||||
| 12 | return { | ||||||||||||||||||||||||||||
| 13 | 0 | ▶ | gendocs => {handler => \&run, info => 'Rebuild HTML from POD docs'}, | ||||||||||||||||||||||||||
|
Subroutine
get_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | sub run { | ||||||||||||||||||||||||||||
| 18 | 0 | ▶ | my ($self, $command) = @_; | ||||||||||||||||||||||||||
|
Subroutine
run: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 0 | my $pod = Serge::Pod->new(); | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 0 | my $pod_root = $pod->{pod_root}; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 0 | my @podfiles; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | print "Scanning .pod files in '$pod_root'..."; | |||||||||||||||||||||||||||
| 27 | find(sub { | ||||||||||||||||||||||||||||
| 28 | 0 | ▶ | push @podfiles, catfile($File::Find::name) if (-f $_ && /\.pod$/); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
Branch: 1 branch
Condition0%0/3
-f $_ and /\.pod$/
MC/DC0%0/2
-f $_ and /\.pod$/
-f $_
/\.pod$/
Truth table0%0/3
A and B
A= -f $_B= /\.pod$/
| |||||||||||||||||||||||||||||
| 29 | 0 | }, $pod_root); | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | my $n = scalar(@podfiles); | |||||||||||||||||||||||||||
| 32 | 0 | print " $n files found\n"; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | foreach my $podfile (@podfiles) { | |||||||||||||||||||||||||||
| 35 | 0 | my $command = abs2rel($podfile, $pod_root); | |||||||||||||||||||||||||||
| 36 | 0 | $command =~ s/\.pod$//; | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | my $htmlfile = $pod->save_html($command, $podfile); | |||||||||||||||||||||||||||
| 39 | 0 | print "Saved $htmlfile\n"; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | return 0; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 1 | 1; | |||||||||||||||||||||||||||