line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
145349
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
71
|
|
2
|
1
|
|
|
1
|
|
10
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
92
|
|
3
|
|
|
|
|
|
|
package WWW::curlmyip; |
4
|
|
|
|
|
|
|
$WWW::curlmyip::VERSION = '0.02'; |
5
|
1
|
|
|
1
|
|
6283
|
use HTTP::Tiny; |
|
1
|
|
|
|
|
81527
|
|
|
1
|
|
|
|
|
40
|
|
6
|
1
|
|
|
1
|
|
19
|
use 5.008; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# ABSTRACT: Returns your ip address using L |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
BEGIN { |
12
|
1
|
|
|
1
|
|
4
|
require Exporter; |
13
|
1
|
|
|
1
|
|
5
|
use base 'Exporter'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
80
|
|
14
|
1
|
|
|
|
|
3
|
our @EXPORT = 'get_ip'; |
15
|
1
|
|
|
|
|
99
|
our @EXPORT_OK = (); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub get_ip { |
20
|
1
|
|
|
1
|
1
|
19
|
my $response = HTTP::Tiny->new->get('http://curlmyip.com'); |
21
|
1
|
50
|
0
|
|
|
298354
|
die join(' ', 'Error fetching ip: ', |
|
|
|
0
|
|
|
|
|
22
|
|
|
|
|
|
|
($response->{status} or ''), |
23
|
|
|
|
|
|
|
($response->{reason} or '')) unless $response->{success}; |
24
|
1
|
|
|
|
|
3
|
my $ip = $response->{content}; |
25
|
1
|
|
|
|
|
4
|
chomp $ip; |
26
|
1
|
|
|
|
|
16
|
$ip; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |