| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Acme::Magic::Pony; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
21478
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
33
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
31
|
|
|
5
|
1
|
|
|
1
|
|
3229
|
use CPAN; |
|
|
1
|
|
|
|
|
533081
|
|
|
|
1
|
|
|
|
|
865
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub _magic_pony { |
|
8
|
7
|
|
|
7
|
|
20
|
my $file = $_[0]; |
|
9
|
7
|
|
|
|
|
12
|
eval { CORE::require( $file ) }; |
|
|
7
|
|
|
|
|
1562
|
|
|
10
|
7
|
100
|
|
|
|
850
|
if( $@ ){ # oops, they don't have it! |
|
11
|
1
|
|
|
|
|
3
|
( my $module = $file ) =~ s/\//::/g; |
|
12
|
1
|
|
|
|
|
6
|
$module =~ s/\.pm$//g; |
|
13
|
1
|
|
|
|
|
58
|
warn "You appear to be missing $module, but don't worry, a Magic Pony is here to help!\n"; |
|
14
|
1
|
|
|
|
|
4
|
*CORE::GLOBAL::require = *CORE::require; # disable magic pony while we go for a ride... |
|
15
|
1
|
|
|
|
|
19
|
CPAN::Shell->install($module); |
|
16
|
0
|
|
|
|
|
|
CORE::require $file; |
|
17
|
0
|
|
|
0
|
|
|
*CORE::GLOBAL::require = sub { _magic_pony(@_) }; |
|
|
0
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
BEGIN { |
|
22
|
1
|
|
|
1
|
|
80
|
*CORE::GLOBAL::require = sub { _magic_pony(@_) }; |
|
|
7
|
|
|
7
|
|
4836
|
|
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Acme::Magic::Pony - Schwern asked for a Magic Pony! |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 VERSION |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Version 0.03 |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
use Acme::Magic::Pony; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
That's it. Every time you use any module, Acme::Magic::Pony will look to see if |
|
44
|
|
|
|
|
|
|
you have it. If you do, it does nothing, but if you're missing it, it will |
|
45
|
|
|
|
|
|
|
attempt to use CPAN::Shell to install it. |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 EXPORT |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Nothing. |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 FUNCTIONS |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
None. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 METHODS |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
None. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 AUTHOR |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Jeff Lavallee, C<< >> |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 BUGS |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, |
|
67
|
|
|
|
|
|
|
or through the web interface at L. |
|
68
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on your |
|
69
|
|
|
|
|
|
|
bug as I make changes. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 SUPPORT |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
perldoc Acme::Magic::Pony |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
You can also look for information at: |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=over 4 |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
L |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
L |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
L |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item * Search CPAN |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
L |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=back |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 INSPIRATION |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Michael G Schwern said: |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
As long as we're talking platitudes, why don't we just say you never have to |
|
107
|
|
|
|
|
|
|
upgrade! In fact, you never even have to install the software, magic ponies |
|
108
|
|
|
|
|
|
|
inside your computer will just know when you need it and go get it for you. [1] |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Also everyone gets a million dollars and a pet dragon. |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
[1] I anticipate the Acme::Magic::Pony auto-installer on CPAN by Monday. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Copyright 2008 Jeff Lavallee, all rights reserved. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
120
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 TODO |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Acme::Magic::Pony doesn't offer to upgrade modules that aren't at the most recent |
|
126
|
|
|
|
|
|
|
version. Maybe it's not so magic after all! |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 NOTE |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This might be vaguely useful when writing new code on a system that doesn't have |
|
131
|
|
|
|
|
|
|
modules you're used to using. It'll fire up CPAN for you and install things as |
|
132
|
|
|
|
|
|
|
you go. But heaven forbid you leave "use Acme::Magic::Pony" around in your code, |
|
133
|
|
|
|
|
|
|
it will be more or less guaranteed to cause anyone who runs across your code no |
|
134
|
|
|
|
|
|
|
end of headaches. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
I'm sure this module could be vastly improved. Please file bugs and/or send me |
|
137
|
|
|
|
|
|
|
email directly. In particular, I'm not sure what a good testing strategy is - |
|
138
|
|
|
|
|
|
|
I suppose I could attempt to identify some module that the user doesn't have, |
|
139
|
|
|
|
|
|
|
and see that Acme::Magic::Pony installs it and that it can then be used, but |
|
140
|
|
|
|
|
|
|
that seems rather intrusive and risky. Ideas? |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
1; # End of Acme::Magic::Pony |