| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package ore; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
31653
|
use 5.014; |
|
|
1
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
20
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
24
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use routines; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
6
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
1753
|
use base 'Exporter'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
102
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
478
|
use Data::Dump; |
|
|
1
|
|
|
|
|
5378
|
|
|
|
1
|
|
|
|
|
61
|
|
|
12
|
1
|
|
|
1
|
|
530
|
use Data::Object::Space; |
|
|
1
|
|
|
|
|
11119
|
|
|
|
1
|
|
|
|
|
36
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
6
|
no strict 'refs'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
278
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our @EXPORT = ('dd'); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.03'; # VERSION |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub import { |
|
21
|
1
|
0
|
|
1
|
|
23389
|
my $args = [map { /([^=]+)=(.*)/; $ENV{$1} = $2 if $1; $1 || () } @ARGV]; |
|
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
1
|
50
|
|
|
|
34
|
new_vars([@$args ? @$args : grep /^New_/, keys %ENV]); |
|
24
|
1
|
50
|
|
|
|
17
|
use_vars([@$args ? @$args : grep /^Use_/, keys %ENV]); |
|
25
|
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
202
|
ore->export_to_level(1, @_); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
1
|
|
|
1
|
0
|
2
|
fun new_vars($args) { |
|
|
1
|
|
|
|
|
2
|
|
|
30
|
1
|
|
|
|
|
3
|
[map new_vars_pump(new_vars_form($_)), @$args] |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
1
|
|
|
1
|
0
|
2
|
fun new_vars_args($spec) { |
|
|
1
|
|
|
|
|
1
|
|
|
34
|
1
|
0
|
|
|
|
6
|
[map { /^\$(\w+)$/ ? ${"ore::$1"} : $_ } @$spec[2..$#$spec]] |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
1
|
|
|
1
|
0
|
23
|
fun new_vars_form($name) { |
|
|
1
|
|
|
|
|
3
|
|
|
38
|
1
|
|
|
|
|
3
|
new_vars_make(new_vars_spec($name)) |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
1
|
|
|
1
|
0
|
2
|
fun new_vars_make($spec) { |
|
|
1
|
|
|
|
|
2
|
|
|
42
|
1
|
|
|
|
|
7
|
[$spec->[1], Data::Object::Space->new($spec->[0])->build(@{new_vars_args($spec)})] |
|
|
1
|
|
|
|
|
10
|
|
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
1
|
|
|
1
|
0
|
2
|
fun new_vars_name($name) { |
|
|
1
|
|
|
|
|
1
|
|
|
46
|
1
|
|
|
|
|
10
|
$name =~ s/^New_//gr =~ s/_/\//gr |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
1
|
|
|
1
|
0
|
1
|
fun new_vars_spec($name) { |
|
|
1
|
|
|
|
|
2
|
|
|
50
|
1
|
|
|
|
|
3
|
[new_vars_name($name), split /;\s*/, $ENV{$name}] |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
1
|
|
|
1
|
0
|
18156
|
fun new_vars_pump($conf) { |
|
|
1
|
|
|
|
|
2
|
|
|
54
|
1
|
|
|
|
|
2
|
${"ore::$$conf[0]"} = $$conf[1]; push @EXPORT, '$'.$$conf[0]; $conf |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
4
|
|
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
1
|
|
|
1
|
0
|
2
|
fun use_vars($args) { |
|
|
1
|
|
|
|
|
2
|
|
|
58
|
1
|
|
|
|
|
2
|
[map use_vars_pump(use_vars_form($_)), @$args] |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
0
|
|
|
0
|
0
|
|
fun use_vars_args($spec) { |
|
|
0
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
|
[map { /^\$(\w+)$/ ? ${"ore::$1"} : $_ } @$spec[2..$#$spec]] |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
0
|
0
|
|
fun use_vars_form($name) { |
|
|
0
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
use_vars_make(use_vars_spec($name)) |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
0
|
|
|
0
|
0
|
|
fun use_vars_make($spec) { |
|
|
0
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
[$spec->[1], Data::Object::Space->new($spec->[0])] |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
0
|
|
|
0
|
0
|
|
fun use_vars_name($name) { |
|
|
0
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
$name =~ s/^Use_//gr =~ s/_/\//gr |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
0
|
|
|
0
|
0
|
|
fun use_vars_spec($name) { |
|
|
0
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
[use_vars_name($name), split /;\s*/, $ENV{$name}] |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
0
|
|
|
0
|
0
|
|
fun use_vars_pump($conf) { |
|
|
0
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
${"ore::$$conf[0]"} = $$conf[1]; push @EXPORT, '$'.$$conf[0]; $conf |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=encoding utf8 |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 NAME |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
ore |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 ABSTRACT |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Sugar for Perl 5 one-liners |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
BEGIN { |
|
104
|
|
|
|
|
|
|
$ENV{New_File_Temp} = 'ft'; |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
use ore; |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
$ft |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# "File::Temp" |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This package provides automatic package handling and object instantiation based |
|
118
|
|
|
|
|
|
|
on environment variables. This is not a toy, but it's also not a joke. This |
|
119
|
|
|
|
|
|
|
package exists because I was bored, shut-in due to the COVID-19 epidemic of |
|
120
|
|
|
|
|
|
|
2020, and inspired by L<new> and the ravings of a madman (mst). Though you |
|
121
|
|
|
|
|
|
|
could use this package in a script it's meant to be used from the command-line. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head2 new-example |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Simple command-line example using env vars to drive object instantiation: |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
$ New_File_Temp=ft perl -More -e 'dd $ft' |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
# "File::Temp" |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 use-example |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Another simple command-line example using env vars to return a |
|
134
|
|
|
|
|
|
|
L<Data::Object::Space> object which calls C<children> and returns an arrayref |
|
135
|
|
|
|
|
|
|
of L<Data::Object::Space> objects: |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
$ Use_DBI=dbi perl -More -e 'dd $dbi->children' |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
# [ |
|
140
|
|
|
|
|
|
|
# ..., |
|
141
|
|
|
|
|
|
|
# "DBI/DBD", |
|
142
|
|
|
|
|
|
|
# "DBI/Profile", |
|
143
|
|
|
|
|
|
|
# "DBI/ProfileData", |
|
144
|
|
|
|
|
|
|
# "DBI/ProfileDumper", |
|
145
|
|
|
|
|
|
|
# ..., |
|
146
|
|
|
|
|
|
|
# ] |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head2 arg-example |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Here's another simple command-line example using args as env vars with ordered |
|
151
|
|
|
|
|
|
|
variable interpolation: |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
$ perl -More -E 'dd $pt' New_File_Temp=ft New_Path_Tiny='pt; $ft' |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
# /var/folders/pc/v4xb_.../T/JtYaKLTTSo |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 etc-example |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Here's a command-line example using the aforementioned sugar with the |
|
160
|
|
|
|
|
|
|
ever-awesome L<Reply> repl: |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
$ New_Path_Tiny='pt; /tmp' reply -More |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
0> $pt |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
# $res[0] = bless(['/tmp', '/tmp'], 'Path::Tiny') |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=cut |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 AUTHOR |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Al Newkirk, C<awncorp@cpan.org> |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 LICENSE |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Copyright (C) 2011-2019, Al Newkirk, et al. |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under the terms |
|
179
|
|
|
|
|
|
|
of the The Apache License, Version 2.0, as elucidated in the L<"license |
|
180
|
|
|
|
|
|
|
file"|https://github.com/iamalnewkirk/ore/blob/master/LICENSE>. |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head1 PROJECT |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
L<Wiki|https://github.com/iamalnewkirk/ore/wiki> |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
L<Project|https://github.com/iamalnewkirk/ore> |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
L<Initiatives|https://github.com/iamalnewkirk/ore/projects> |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
L<Milestones|https://github.com/iamalnewkirk/ore/milestones> |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
L<Contributing|https://github.com/iamalnewkirk/ore/blob/master/CONTRIBUTE.md> |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
L<Issues|https://github.com/iamalnewkirk/ore/issues> |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=cut |