line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::TVDB::Util; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$WebService::TVDB::Util::VERSION = '1.133200'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
29754
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
63
|
|
7
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
624
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Utility functions |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
require Exporter; |
12
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
13
|
|
|
|
|
|
|
our @EXPORT_OK = qw(pipes_to_array get_api_key_from_file); |
14
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( all => \@EXPORT_OK ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub pipes_to_array { |
17
|
1
|
|
|
1
|
1
|
11
|
my $string = shift; |
18
|
1
|
50
|
|
|
|
3
|
return unless $string; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
2
|
my @array; |
21
|
1
|
|
|
|
|
5
|
for ( split( /\|/, $string ) ) { |
22
|
3
|
100
|
|
|
|
6
|
next unless $_; |
23
|
2
|
|
|
|
|
5
|
push @array, $_; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
11
|
return \@array; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub get_api_key_from_file { |
30
|
1
|
|
|
1
|
1
|
2
|
my ($file) = @_; |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
1
|
return do { |
33
|
1
|
|
|
|
|
5
|
local $/ = undef; |
34
|
1
|
50
|
|
|
|
53
|
open my $fh, "<", $file |
35
|
|
|
|
|
|
|
or die "could not open $file: $!"; |
36
|
1
|
|
|
|
|
23
|
my $doc = <$fh>; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# ensure there are no carriage returns |
39
|
1
|
|
|
|
|
4
|
$doc =~ s/(\r|\n)//g; |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
16
|
return $doc; |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |