| 1 | package Code::TidyAll::Util; | ||||||||||||
| 2 | |||||||||||||
| 3 | 27 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 27 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 27 | ▶ | use File::Spec; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 27 | ▶ | use Path::Tiny 0.098 qw(tempdir); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | 27 | ▶ | use Exporter qw(import); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | |||||||||||||
| 11 | 27 | our $VERSION = '0.83'; | |||||||||||
| 12 | |||||||||||||
| 13 | 27 | our @EXPORT_OK = qw(tempdir_simple); | |||||||||||
| 14 | |||||||||||||
| 15 | 27 | ▶ | use constant IS_WIN32 => $^O eq 'MSWin32'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 16 | |||||||||||||
| 17 | sub tempdir_simple { | ||||||||||||
| 18 | 69 | ▶ | my $template = shift || 'Code-TidyAll-XXXX'; | ||||||||||
|
Subroutine
tempdir_simple: called CC=2 SCAR=7.0
Pod
undocumented
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 | 69 | 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 | 69 | if (IS_WIN32) { | |||||||||||
| 32 | require Win32; | ||||||||||||
| 33 | $args{DIR} = Win32::GetLongPathName( File::Spec->tmpdir ); | ||||||||||||
| 34 | } | ||||||||||||
| 35 | |||||||||||||
| 36 | 69 | return tempdir( | |||||||||||
| 37 | { realpath => 1 }, | ||||||||||||
| 38 | %args, | ||||||||||||
| 39 | ); | ||||||||||||
| 40 | } | ||||||||||||
| 41 | |||||||||||||
| 42 | 27 | 1; | |||||||||||
| 43 | |||||||||||||
| 44 | # ABSTRACT: Utility functions for internal use by Code::TidyAll | ||||||||||||
| 45 | |||||||||||||
| 46 | __END__ | ||||||||||||
| 47 | |||||||||||||
| 48 | =pod | ||||||||||||
| 49 | |||||||||||||
| 50 | =encoding UTF-8 | ||||||||||||
| 51 | |||||||||||||
| 52 | =head1 NAME | ||||||||||||
| 53 | |||||||||||||
| 54 | Code::TidyAll::Util - Utility functions for internal use by Code::TidyAll | ||||||||||||
| 55 | |||||||||||||
| 56 | =head1 VERSION | ||||||||||||
| 57 | |||||||||||||
| 58 | version 0.83 | ||||||||||||
| 59 | |||||||||||||
| 60 | =head1 SUPPORT | ||||||||||||
| 61 | |||||||||||||
| 62 | Bugs may be submitted at L<https://github.com/houseabsolute/perl-code-tidyall/issues>. | ||||||||||||
| 63 | |||||||||||||
| 64 | =head1 SOURCE | ||||||||||||
| 65 | |||||||||||||
| 66 | The source code repository for Code-TidyAll can be found at L<https://github.com/houseabsolute/perl-code-tidyall>. | ||||||||||||
| 67 | |||||||||||||
| 68 | =head1 AUTHORS | ||||||||||||
| 69 | |||||||||||||
| 70 | =over 4 | ||||||||||||
| 71 | |||||||||||||
| 72 | =item * | ||||||||||||
| 73 | |||||||||||||
| 74 | Jonathan Swartz <swartz@pobox.com> | ||||||||||||
| 75 | |||||||||||||
| 76 | =item * | ||||||||||||
| 77 | |||||||||||||
| 78 | Dave Rolsky <autarch@urth.org> | ||||||||||||
| 79 | |||||||||||||
| 80 | =back | ||||||||||||
| 81 | |||||||||||||
| 82 | =head1 COPYRIGHT AND LICENSE | ||||||||||||
| 83 | |||||||||||||
| 84 | This software is copyright (c) 2011 - 2022 by Jonathan Swartz. | ||||||||||||
| 85 | |||||||||||||
| 86 | This is free software; you can redistribute it and/or modify it under | ||||||||||||
| 87 | the same terms as the Perl 5 programming language system itself. | ||||||||||||
| 88 | |||||||||||||
| 89 | The full text of the license can be found in the | ||||||||||||
| 90 | F<LICENSE> file included with this distribution. | ||||||||||||
| 91 | |||||||||||||
| 92 | =cut | ||||||||||||