line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package YAML::LoadURI;
|
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
78853
|
use warnings;
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
74
|
|
4
|
2
|
|
|
2
|
|
11
|
use strict;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
99
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.01';
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
12
|
use base 'Exporter';
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
228
|
|
9
|
|
|
|
|
|
|
our @EXPORT = ('LoadURI');
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
1956
|
use LWP::Simple ();
|
|
2
|
|
|
|
|
343867
|
|
|
2
|
|
|
|
|
64
|
|
12
|
2
|
|
|
2
|
|
2506
|
use YAML::Any ();
|
|
2
|
|
|
|
|
3379
|
|
|
2
|
|
|
|
|
43
|
|
13
|
2
|
|
|
2
|
|
15
|
use Carp qw/croak/;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
516
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub LoadURI {
|
16
|
1
|
|
|
1
|
1
|
174
|
my ( $uri, $opts ) = @_;
|
17
|
|
|
|
|
|
|
|
18
|
1
|
50
|
|
|
|
8
|
$opts->{raise_error} = 1 unless exists $opts->{raise_error};
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
4
|
my $yaml = LWP::Simple::get($uri);
|
21
|
1
|
50
|
|
|
|
144
|
unless (defined $yaml) {
|
22
|
0
|
0
|
|
|
|
0
|
croak "Couldn't get it!" if $opts->{raise_error};
|
23
|
0
|
|
|
|
|
0
|
return undef;
|
24
|
|
|
|
|
|
|
}
|
25
|
1
|
50
|
|
|
|
13
|
unless ( $yaml =~ /^---/ ) {
|
26
|
0
|
0
|
|
|
|
0
|
croak "invalid YAML" if $opts->{raise_error};
|
27
|
0
|
|
|
|
|
0
|
return undef;
|
28
|
|
|
|
|
|
|
}
|
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
7
|
return YAML::Any::Load($yaml);
|
31
|
|
|
|
|
|
|
}
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1;
|
34
|
|
|
|
|
|
|
__END__
|