| 1 | package Code::TidyAll::Util; | ||||||||||||
| 2 | |||||||||||||
| 3 | 31 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 31 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 31 | ▶ | use File::Spec; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 31 | ▶ | use Path::Tiny 0.098 qw(tempdir); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | 31 | ▶ | use Exporter qw(import); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | |||||||||||||
| 11 | 31 | our $VERSION = '0.85'; | |||||||||||
| 12 | |||||||||||||
| 13 | 31 | our @EXPORT_OK = qw(tempdir_simple); | |||||||||||
| 14 | |||||||||||||
| 15 | 31 | ▶ | use constant IS_WIN32 => $^O eq 'MSWin32'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 16 | |||||||||||||
| 17 | 73 | ▶ | sub tempdir_simple { | ||||||||||
|
Subroutine
tempdir_simple: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||
| 18 | 73 | ▶ | my $template = shift || 'Code-TidyAll-XXXX'; | ||||||||||
|
Condition50%1/2
shift() || 'Code-TidyAll-XXXX'
MC/DC0%0/1
shift() || 'Code-TidyAll-XXXX'
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||
| 19 | |||||||||||||
| 20 | 73 | my %args = ( | |||||||||||
| 21 | TEMPLATE => $template, | ||||||||||||
| 22 | CLEANUP => 1 | ||||||||||||
| 23 | ); | ||||||||||||
| 24 | |||||||||||||
| 25 | # On Windows the default tmpdir is under C:\Users\<Current User>. If the | ||||||||||||
| 26 | # current user name is long or has spaces, then you get a short name like | ||||||||||||
| 27 | # LONGUS~1. But lots of other code, particularly in the tests, will end up | ||||||||||||
| 28 | # seeing long path names. This makes comparing paths to see if one path is | ||||||||||||
| 29 | # under the tempdir fail, because the long name and short name don't | ||||||||||||
| 30 | # compare as equal. | ||||||||||||
| 31 | 73 | if (IS_WIN32) { | |||||||||||
| 32 | require Win32; | ||||||||||||
| 33 | $args{DIR} = Win32::GetLongPathName( File::Spec->tmpdir ); | ||||||||||||
| 34 | } | ||||||||||||
| 35 | |||||||||||||
| 36 | 73 | return tempdir( | |||||||||||
| 37 | { realpath => 1 }, | ||||||||||||
| 38 | %args, | ||||||||||||
| 39 | ); | ||||||||||||
| 40 | } | ||||||||||||
| 41 | |||||||||||||
| 42 | 31 | 1; | |||||||||||
| 43 | |||||||||||||
| 44 | # ABSTRACT: Utility functions for internal use by Code::TidyAll | ||||||||||||
| 45 | |||||||||||||
| 46 | __END__ | ||||||||||||