line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
979
|
use 5.005; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
43
|
|
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
57
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package ARGV::Abs; |
6
|
|
|
|
|
|
|
{ |
7
|
|
|
|
|
|
|
$ARGV::Abs::VERSION = '1.01'; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
4
|
use File::Spec; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
262
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub import |
14
|
|
|
|
|
|
|
{ |
15
|
|
|
|
|
|
|
# Base directory for resolving paths |
16
|
0
|
|
|
0
|
|
|
my $base = $_[1]; |
17
|
0
|
0
|
|
|
|
|
unless (defined $base) { |
18
|
0
|
|
|
|
|
|
require Cwd; |
19
|
0
|
|
|
|
|
|
$base = Cwd::getcwd(); |
20
|
|
|
|
|
|
|
} |
21
|
0
|
|
|
|
|
|
@ARGV = map { File::Spec->rel2abs($_, $base) } @ARGV; |
|
0
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 NAME |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
ARGV::Abs - Transform paths in @ARGV to absolute paths |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 VERSION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
version 1.01 |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
From one-liners (see L): |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
perl -MARGV::Abs -E "..." foo.txt bar.txt ... |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
From a script where B arguments are expected to be filenames: |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
use ARG::Abs; |
43
|
|
|
|
|
|
|
... |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
From a script that takes command-line options that should not be processed by |
46
|
|
|
|
|
|
|
C : |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# Skipping import |
49
|
|
|
|
|
|
|
use ARGV::Abs (); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
... extract options from @ARGV ... |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# Transform paths: do import now |
54
|
|
|
|
|
|
|
ARGV::Abs->import; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Resolve relative paths using base directory F: |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
perl -MARGV::Abs=/tmp -E "..." foo.txt bar.txt ... |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
use ARGV::Abs '/tmp'; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 DESCRIPTION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This module transform all elements of C<@ARGV> into absolute pathnames. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Relative paths are resolved by default relative to the current directory. |
67
|
|
|
|
|
|
|
To use another base directory, pass it as the argument for import. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SEE ALSO |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Some other modules that add magic to C<@ARGV>: L, L, L. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 AUTHOR |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Olivier MenguE, L. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Copyright E 2011 Olivier MenguE. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
82
|
|
|
|
|
|
|
the same terms as Perl 5 itself. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |