| 1 | package FindApp::Utils::Misc; | ||||||||||
| 2 | |||||||||||
| 3 | 6 | ▶ | use v5.10; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 6 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 6 | ▶ | use FindApp::Utils::Assert ":all"; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 6 | ▶ | use FindApp::Utils::Foreign ":Scalar::Util"; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | ################################################################# | ||||||||||
| 11 | |||||||||||
| 12 | sub is_csh ( ) ; | ||||||||||
| 13 | sub n_times ( _ ) ; | ||||||||||
| 14 | |||||||||||
| 15 | ################################################################# | ||||||||||
| 16 | |||||||||||
| 17 | 6 | ▶ | use Exporter qw(import); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 6 | our $VERSION = v1.0; | |||||||||
| 19 | 6 | our @EXPORT_OK = qw( | |||||||||
| 20 | is_csh | ||||||||||
| 21 | n_times | ||||||||||
| 22 | ); | ||||||||||
| 23 | 6 | our %EXPORT_TAGS = ( | |||||||||
| 24 | all => \@EXPORT_OK, | ||||||||||
| 25 | ); | ||||||||||
| 26 | |||||||||||
| 27 | ################################################################# | ||||||||||
| 28 | |||||||||||
| 29 | sub is_csh() { | ||||||||||
| 30 | 0 | ▶ | state $is_csh = do { | ||||||||
|
Subroutine
is_csh: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 31 | 0 | my $parent = getppid(); | |||||||||
| 32 | 0 | `ps c$parent` =~ /t?[c-]sh\b/; | |||||||||
| 33 | }; | ||||||||||
| 34 | 0 | return $is_csh; | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | sub n_times(_) { | ||||||||||
| 38 | 0 | ▶ | good_args(@_ == 1); | ||||||||
|
Subroutine
n_times: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||
| 39 | 0 | my($n) = @_; | |||||||||
| 40 | 0 | ▶ | looks_like_number($n) || croak("n_times argument should be a number, not $n"); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | 0 | ▶ | return "never" unless $n; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | 0 | ▶ | return "once" if $n == 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 0 | ▶ | return "twice" if $n == 2; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 0 | ▶ | return "thrice" if $n == 3; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | 0 | return "$n times"; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 6 | 1; | |||||||||
| 49 | |||||||||||
| 50 | =encoding utf8 | ||||||||||
| 51 | |||||||||||
| 52 | =head1 NAME | ||||||||||
| 53 | |||||||||||
| 54 | FindApp::Utils::Misc - FIXME | ||||||||||
| 55 | |||||||||||
| 56 | =head1 SYNOPSIS | ||||||||||
| 57 | |||||||||||
| 58 | use FindApp::Utils::Misc; | ||||||||||
| 59 | |||||||||||
| 60 | =head1 DESCRIPTION | ||||||||||
| 61 | |||||||||||
| 62 | =head2 Public Methods | ||||||||||
| 63 | |||||||||||
| 64 | =over | ||||||||||
| 65 | |||||||||||
| 66 | =item FIXME | ||||||||||
| 67 | |||||||||||
| 68 | =back | ||||||||||
| 69 | |||||||||||
| 70 | =head2 Exports | ||||||||||
| 71 | |||||||||||
| 72 | =over | ||||||||||
| 73 | |||||||||||
| 74 | =item FIXME | ||||||||||
| 75 | |||||||||||
| 76 | =item is_csh | ||||||||||
| 77 | |||||||||||
| 78 | =item n_times | ||||||||||
| 79 | |||||||||||
| 80 | =back | ||||||||||
| 81 | |||||||||||
| 82 | =head1 EXAMPLES | ||||||||||
| 83 | |||||||||||
| 84 | =head1 ENVIRONMENT | ||||||||||
| 85 | |||||||||||
| 86 | =head1 SEE ALSO | ||||||||||
| 87 | |||||||||||
| 88 | =over | ||||||||||
| 89 | |||||||||||
| 90 | =item L<FindApp> | ||||||||||
| 91 | |||||||||||
| 92 | =back | ||||||||||
| 93 | |||||||||||
| 94 | =head1 CAVEATS AND PROVISOS | ||||||||||
| 95 | |||||||||||
| 96 | =head1 BUGS AND LIMITATIONS | ||||||||||
| 97 | |||||||||||
| 98 | =head1 HISTORY | ||||||||||
| 99 | |||||||||||
| 100 | =head1 AUTHOR | ||||||||||
| 101 | |||||||||||
| 102 | Tom Christiansen << <tchrist@perl.com> >> | ||||||||||
| 103 | |||||||||||
| 104 | =head1 LICENCE AND COPYRIGHT | ||||||||||
| 105 | |||||||||||
| 106 | Copyright (c) 2016, Tom Christiansen C<< <tchrist@perl.com> >>. | ||||||||||
| 107 | All Rights Reserved. | ||||||||||
| 108 | |||||||||||
| 109 | This module is free software; you can redistribute it and/or | ||||||||||
| 110 | modify it under the same terms as Perl itself. See L<perlartistic>. | ||||||||||
| 111 | |||||||||||
| 112 | =cut | ||||||||||
| 113 | |||||||||||