line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
1764
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
2
|
|
|
|
|
|
|
package Env::Heroku::Redis; |
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PNU'; |
4
|
|
|
|
|
|
|
# ABSTRACT: env for heroku-redis |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
7
|
1
|
|
|
1
|
|
5
|
use URI; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
156
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.003'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub import { |
12
|
1
|
|
|
1
|
|
6
|
my ($self) = @_; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
50
|
|
|
8
|
my $redisurl = $ENV{REDIS_URL} || 'redis://localhost:6379/'; |
15
|
1
|
50
|
33
|
|
|
8
|
if ( $redisurl and $redisurl =~ s/^redis:// ) { |
16
|
1
|
|
|
|
|
4
|
my $url = URI->new( $redisurl, 'http' ); |
17
|
1
|
|
|
|
|
7993
|
$ENV{REDISHOST} = $url->host; |
18
|
1
|
|
|
|
|
168
|
$ENV{REDISPORT} = $url->port; |
19
|
1
|
50
|
|
|
|
36
|
(undef,$ENV{REDISPASSWORD}) = split ':', $url->userinfo |
20
|
|
|
|
|
|
|
if $url->userinfo; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
42
|
return 1; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
__END__ |