line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
1310
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
2
|
|
|
|
|
|
|
package Env::Heroku::Rediscloud; |
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PNU'; |
4
|
|
|
|
|
|
|
# ABSTRACT: env for rediscloud |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
7
|
1
|
|
|
1
|
|
5
|
use URI; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
169
|
|
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{REDISCLOUD_URL} || 'redis://localhost:6379/'; |
15
|
1
|
50
|
33
|
|
|
9
|
if ( $redisurl and $redisurl =~ s/^redis:// ) { |
16
|
1
|
|
|
|
|
5
|
my $url = URI->new( $redisurl, 'http' ); |
17
|
1
|
|
|
|
|
66
|
$ENV{REDISHOST} = $url->host; |
18
|
1
|
|
|
|
|
27
|
$ENV{REDISPORT} = $url->port; |
19
|
1
|
50
|
|
|
|
21
|
(undef,$ENV{REDISPASSWORD}) = split ':', $url->userinfo |
20
|
|
|
|
|
|
|
if $url->userinfo; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
22
|
return 1; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
__END__ |