| 1 | package FindApp::Utils::Foreign; | ||
| 2 | |||
| 3 | use v5.10; | ||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | |||
| 7 | use File::Spec qw(); | ||
| 8 | |||
| 9 | ################################################################# | ||
| 10 | |||
| 11 | use Exporter qw(import); | ||
| 12 | our $VERSION = v1.0; | ||
| 13 | |||
| 14 | my %Exported_Imports; BEGIN { | ||
| 15 | |||
| 16 | %Exported_Imports = ( | ||
| 17 | "Carp" => [ qw(carp croak cluck confess) ], | ||
| 18 | "Cwd" => [ qw(abs_path getcwd) ], | ||
| 19 | "Data::Dump" => [ qw(dd pp) ], | ||
| 20 | "File::Basename" => [ qw(basename dirname fileparse) ], | ||
| 21 | "Scalar::Util" => [ qw(blessed looks_like_number refaddr reftype set_prototype) ], | ||
| 22 | ); | ||
| 23 | |||
| 24 | while (my($module, $imports) = each %Exported_Imports) { | ||
| 25 | eval qq{ require $module; 1 } || die; | ||
| 26 | $module->import(@$imports); | ||
| 27 | } | ||
| 28 | |||
| 29 | } | ||
| 30 | |||
| 31 | { | ||
| 32 | no warnings qw(redefine prototype); | ||
| 33 | |||
| 34 | sub abs_path(_) { &Cwd::abs_path } | ||
| 35 | sub basename(_;$) { &File::Basename::basename } | ||
| 36 | sub blessed(_) { &Scalar::Util::blessed } | ||
| 37 | sub dirname(_) { &File::Basename::dirname } | ||
| 38 | sub getcwd() { &Cwd::getcwd } | ||
| 39 | sub looks_like_number(_) { &Scalar::Util::looks_like_number } | ||
| 40 | sub refaddr(_) { &Scalar::Util::refaddr } | ||
| 41 | sub reftype(_) { &Scalar::Util::reftype } | ||
| 42 | } | ||
| 43 | |||
| 44 | our @EXPORT_OK = sort abs2rel => map { @$_ } values %Exported_Imports; | ||
| 45 | |||
| 46 | our %EXPORT_TAGS = %Exported_Imports; | ||
| 47 | $EXPORT_TAGS{all} = \@EXPORT_OK; | ||
| 48 | |||
| 49 | sub abs2rel(_) { | ||
| 50 | my($path) = @_; | ||
| 51 | return File::Spec->abs2rel($path); | ||
| 52 | } | ||
| 53 | |||
| 54 | 1; | ||
| 55 | |||
| 56 | =encoding utf8 | ||
| 57 | |||
| 58 | =head1 NAME | ||
| 59 | |||
| 60 | FindApp::Utils::Foreign - FIXME | ||
| 61 | |||
| 62 | =head1 SYNOPSIS | ||
| 63 | |||
| 64 | use FindApp::Utils::Foreign; | ||
| 65 | |||
| 66 | =head1 DESCRIPTION | ||
| 67 | |||
| 68 | =head2 Exports | ||
| 69 | |||
| 70 | =over | ||
| 71 | |||
| 72 | =item abs2rel | ||
| 73 | |||
| 74 | =back | ||
| 75 | |||
| 76 | =head1 ENVIRONMENT | ||
| 77 | |||
| 78 | =head1 SEE ALSO | ||
| 79 | |||
| 80 | =over | ||
| 81 | |||
| 82 | =item L<FindApp> | ||
| 83 | |||
| 84 | =back | ||
| 85 | |||
| 86 | =head1 CAVEATS AND PROVISOS | ||
| 87 | |||
| 88 | =head1 BUGS AND LIMITATIONS | ||
| 89 | |||
| 90 | =head1 HISTORY | ||
| 91 | |||
| 92 | =head1 AUTHOR | ||
| 93 | |||
| 94 | Tom Christiansen << <tchrist@perl.com> >> | ||
| 95 | |||
| 96 | =head1 LICENCE AND COPYRIGHT | ||
| 97 | |||
| 98 | Copyright (c) 2016, Tom Christiansen C<< <tchrist@perl.com> >>. | ||
| 99 | All Rights Reserved. | ||
| 100 | |||
| 101 | This module is free software; you can redistribute it and/or | ||
| 102 | modify it under the same terms as Perl itself. See L<perlartistic>. | ||
| 103 | |||
| 104 | =cut | ||
| 105 |