| 1 | package Pod::Perldoc::BaseTo; | ||||||||||||||
| 2 | 4 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 3 | 4 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | |||||||||||||||
| 5 | 4 | ▶ | use vars qw($VERSION); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | 4 | $VERSION = '3.28'; | |||||||||||||
| 7 | |||||||||||||||
| 8 | 4 | ▶ | use Carp qw(croak carp); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 9 | 4 | ▶ | use Config qw(%Config); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 10 | 4 | ▶ | use File::Spec::Functions qw(catfile); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 11 | |||||||||||||||
| 12 | 0 | ▶ | sub is_pageable { '' } | ||||||||||||
|
Subroutine
is_pageable: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 13 | 0 | ▶ | sub write_with_binmode { 1 } | ||||||||||||
|
Subroutine
write_with_binmode: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 14 | |||||||||||||||
| 15 | 0 | ▶ | sub output_extension { 'txt' } # override in subclass! | ||||||||||||
|
Subroutine
output_extension: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 16 | |||||||||||||||
| 17 | # sub new { my $self = shift; ... } | ||||||||||||||
| 18 | # sub parse_from_file( my($class, $in, $out) = ...; ... } | ||||||||||||||
| 19 | |||||||||||||||
| 20 | #sub new { return bless {}, ref($_[0]) || $_[0] } | ||||||||||||||
| 21 | |||||||||||||||
| 22 | # this is also in Perldoc.pm, but why look there when you're a | ||||||||||||||
| 23 | # subclass of this? | ||||||||||||||
| 24 | sub TRUE () {1} | ||||||||||||||
| 25 | 0 | ▶ | sub FALSE () {return} | ||||||||||||
|
Subroutine
FALSE: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 26 | |||||||||||||||
| 27 | 4 | ▶ | BEGIN { | ||||||||||||
|
Subroutine
BEGIN: called CC=21 SCAR=39.0
| |||||||||||||||
| 28 | 4 | ▶ | *is_vms = $^O eq 'VMS' ? \&TRUE : \&FALSE unless defined &is_vms; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 29 | 4 | ▶ | *is_mswin32 = $^O eq 'MSWin32' ? \&TRUE : \&FALSE unless defined &is_mswin32; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 30 | 4 | ▶ | *is_dos = $^O eq 'dos' ? \&TRUE : \&FALSE unless defined &is_dos; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 31 | 4 | ▶ | *is_os2 = $^O eq 'os2' ? \&TRUE : \&FALSE unless defined &is_os2; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 32 | 4 | ▶ | *is_cygwin = $^O eq 'cygwin' ? \&TRUE : \&FALSE unless defined &is_cygwin; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 33 | 4 | ▶ | *is_linux = $^O eq 'linux' ? \&TRUE : \&FALSE unless defined &is_linux; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 34 | 4 | ▶ | *is_hpux = $^O =~ m/hpux/ ? \&TRUE : \&FALSE unless defined &is_hpux; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 35 | 4 | ▶ | *is_openbsd = $^O =~ m/openbsd/ ? \&TRUE : \&FALSE unless defined &is_openbsd; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 36 | 4 | ▶ | *is_freebsd = $^O =~ m/freebsd/ ? \&TRUE : \&FALSE unless defined &is_freebsd; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 37 | 4 | ▶ | *is_bitrig = $^O =~ m/bitrig/ ? \&TRUE : \&FALSE unless defined &is_bitrig; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 38 | } | ||||||||||||||
| 39 | |||||||||||||||
| 40 | 1 | ▶ | sub _perldoc_elem { | ||||||||||||
|
Subroutine
_perldoc_elem: called CC=2 SCAR=7.6
| |||||||||||||||
| 41 | 1 | my($self, $name) = splice @_,0,2; | |||||||||||||
| 42 | 1 | ▶ | if(@_) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 43 | 0 | $self->{$name} = $_[0]; | |||||||||||||
| 44 | } else { | ||||||||||||||
| 45 | 1 | $self->{$name}; | |||||||||||||
| 46 | } | ||||||||||||||
| 47 | } | ||||||||||||||
| 48 | |||||||||||||||
| 49 | 0 | ▶ | sub debugging { | ||||||||||||
|
Subroutine
debugging: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||
| 50 | 0 | my( $self, @messages ) = @_; | |||||||||||||
| 51 | |||||||||||||||
| 52 | 0 | ▶ | ( defined(&Pod::Perldoc::DEBUG) and &Pod::Perldoc::DEBUG() ) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 53 | } | ||||||||||||||
| 54 | |||||||||||||||
| 55 | 0 | ▶ | sub debug { | ||||||||||||
|
Subroutine
debug: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||
| 56 | 0 | my( $self, @messages ) = @_; | |||||||||||||
| 57 | 0 | ▶ | return unless $self->debugging; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 58 | 0 | print STDERR map { "DEBUG $_" } @messages; | |||||||||||||
| 59 | } | ||||||||||||||
| 60 | |||||||||||||||
| 61 | 0 | ▶ | sub warn { | ||||||||||||
|
Subroutine
warn: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 62 | 0 | my( $self, @messages ) = @_; | |||||||||||||
| 63 | 0 | carp join "\n", @messages, ''; | |||||||||||||
| 64 | } | ||||||||||||||
| 65 | |||||||||||||||
| 66 | 0 | ▶ | sub die { | ||||||||||||
|
Subroutine
die: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 67 | 0 | my( $self, @messages ) = @_; | |||||||||||||
| 68 | 0 | croak join "\n", @messages, ''; | |||||||||||||
| 69 | } | ||||||||||||||
| 70 | |||||||||||||||
| 71 | 0 | ▶ | sub _get_path_components { | ||||||||||||
|
Subroutine
_get_path_components: not called CC=1 SCAR=6.9
| |||||||||||||||
| 72 | 0 | my( $self ) = @_; | |||||||||||||
| 73 | |||||||||||||||
| 74 | 0 | my @paths = split /\Q$Config{path_sep}/, $ENV{PATH}; | |||||||||||||
| 75 | |||||||||||||||
| 76 | 0 | return @paths; | |||||||||||||
| 77 | } | ||||||||||||||
| 78 | |||||||||||||||
| 79 | 0 | ▶ | sub _find_executable_in_path { | ||||||||||||
|
Subroutine
_find_executable_in_path: not called CC=4 SCAR=30.0
| |||||||||||||||
| 80 | 0 | my( $self, $program ) = @_; | |||||||||||||
| 81 | |||||||||||||||
| 82 | 0 | my @found = (); | |||||||||||||
| 83 | 0 | foreach my $dir ( $self->_get_path_components ) { | |||||||||||||
| 84 | 0 | my $binary = catfile( $dir, $program ); | |||||||||||||
| 85 | 0 | $self->debug( "Looking for $binary\n" ); | |||||||||||||
| 86 | 0 | ▶ | next unless -e $binary; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 87 | 0 | ▶ | unless( -x $binary ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 88 | 0 | $self->warn( "Found $binary but it's not executable. Skipping.\n" ); | |||||||||||||
| 89 | 0 | next; | |||||||||||||
| 90 | } | ||||||||||||||
| 91 | 0 | $self->debug( "Found $binary\n" ); | |||||||||||||
| 92 | 0 | push @found, $binary; | |||||||||||||
| 93 | } | ||||||||||||||
| 94 | |||||||||||||||
| 95 | 0 | return @found; | |||||||||||||
| 96 | } | ||||||||||||||
| 97 | |||||||||||||||
| 98 | 4 | 1; | |||||||||||||
| 99 | |||||||||||||||
| 100 | __END__ | ||||||||||||||