| 1 | package Win32::PowerPoint::Utils; | ||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||
| 8 | 1 | our @EXPORT_OK = qw( | |||||||||||||||||||||||||||||||||||
| 9 | RGB | ||||||||||||||||||||||||||||||||||||
| 10 | canonical_alignment | ||||||||||||||||||||||||||||||||||||
| 11 | canonical_pattern | ||||||||||||||||||||||||||||||||||||
| 12 | canonical_datetime | ||||||||||||||||||||||||||||||||||||
| 13 | convert_cygwin_path | ||||||||||||||||||||||||||||||||||||
| 14 | _defined_or | ||||||||||||||||||||||||||||||||||||
| 15 | ); | ||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | sub _defined_or { | ||||||||||||||||||||||||||||||||||
|
Subroutine
_defined_or: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||
| 18 | 0 | my ($target, $alternative) = @_; | |||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | return defined $target ? $target : $alternative; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub RGB { | ||||||||||||||||||||||||||||||||||
|
Subroutine
RGB: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 24 | 0 | my @color; | |||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | if ( @_ == 1 && !ref $_[0] ) { # combined string such as '255, 255, 255' | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
@_ == 1 and not ref $_[0]
MC/DC0%0/2
@_ == 1 and not ref $_[0]
@_ == 1
not ref $_[0]
Truth table0%0/3
A and not(B)
A= @_ == 1B= not ref $_[0]
| |||||||||||||||||||||||||||||||||||||
| 27 | 0 | my $str = shift; | |||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||
| 29 | 0 | $str =~ s/^RGB//i; | |||||||||||||||||||||||||||||||||||
| 30 | 0 | $str =~ tr/()//d; | |||||||||||||||||||||||||||||||||||
| 31 | 0 | @color = _check_colors( split /[\s,]+/, $str ); | |||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||
| 33 | ▶ | elsif ( @_ == 1 && ref $_[0] eq 'ARRAY' ) { | |||||||||||||||||||||||||||||||||||
|
Condition0%0/3
@_ == 1 and ref $_[0] eq "ARRAY"
MC/DC0%0/2
@_ == 1 and ref $_[0] eq "ARRAY"
@_ == 1
ref $_[0] eq "ARRAY"
Truth table0%0/3
A and B
A= @_ == 1B= ref $_[0] eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||
| 34 | 0 | @color = _check_colors( @{ $_[0] } ); | |||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||
| 36 | elsif ( @_ == 3 ) { | ||||||||||||||||||||||||||||||||||||
| 37 | 0 | @color = _check_colors( @_ ); | |||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | croak "wrong color specification" unless @color == 3; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||
| 42 | 0 | return $color[2] * 65536 + $color[1] * 256 + $color[0]; | |||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub _check_colors { | ||||||||||||||||||||||||||||||||||
|
Subroutine
_check_colors: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||
| 46 | 0 | my @colors = @_; | |||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | return map { $_ = 0 if $_ < 0; $_ = 255 if $_ > 255; $_ } | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | grep { defined $_ && /^\d+$/ } | ||||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $_ && /^\d+$/
MC/DC0%0/2
defined $_ && /^\d+$/
defined $_
/^\d+$/
Truth table0%0/3
A && B
A= defined $_B= /^\d+$/
| |||||||||||||||||||||||||||||||||||||
| 50 | @colors; | ||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | sub canonical_alignment { | ||||||||||||||||||||||||||||||||||
|
Subroutine
canonical_alignment: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 54 | 0 | my $align = shift; | |||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||
| 56 | 0 | $align =~ s/^(?:pp)?align(?:ment)?//gi; | |||||||||||||||||||||||||||||||||||
| 57 | 0 | $align = 'ppAlign' . (ucfirst lc $align); | |||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | $align = 'ppAlignCenter' if $align eq 'ppAlignCentre'; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | $align = 'ppAlignmentMixed' if $align eq 'ppAlignMixed'; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||
| 61 | 0 | $align; | |||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub canonical_pattern { | ||||||||||||||||||||||||||||||||||
|
Subroutine
canonical_pattern: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 65 | 0 | my $pattern = shift; | |||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||
| 67 | 0 | $pattern =~ s/^(?:mso)?Pattern//gi; | |||||||||||||||||||||||||||||||||||
| 68 | 0 | $pattern =~ s/_([a-z])/\U$1\E/g; | |||||||||||||||||||||||||||||||||||
| 69 | 0 | $pattern =~ s/(^|[0-9])([a-z])/$1\U$2\E/g; | |||||||||||||||||||||||||||||||||||
| 70 | 0 | $pattern = "msoPattern$pattern"; | |||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||
| 72 | 0 | $pattern; | |||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | sub canonical_datetime { | ||||||||||||||||||||||||||||||||||
|
Subroutine
canonical_datetime: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 76 | 0 | my $pattern = shift; | |||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||
| 78 | 0 | $pattern =~ s/^(?:pp)?DateTime//gi; | |||||||||||||||||||||||||||||||||||
| 79 | 0 | $pattern ="ppDateTime$pattern"; | |||||||||||||||||||||||||||||||||||
| 80 | 0 | $pattern; | |||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | sub convert_cygwin_path { | ||||||||||||||||||||||||||||||||||
|
Subroutine
convert_cygwin_path: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 84 | 0 | my $path = shift; | |||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | return $path unless $^O eq 'cygwin'; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | return Cygwin::posix_to_win_path($path, 'absolute') if $] >= 5.010; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 87 | 0 | require Filesys::CygwinPaths; | |||||||||||||||||||||||||||||||||||
| 88 | 0 | return Filesys::CygwinPaths::fullwin32path($path); | |||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||
| 91 | 1 | 1; | |||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||
| 93 | __END__ | ||||||||||||||||||||||||||||||||||||