| 1 | # $Id: Results.pm,v 1.4 2003/07/21 15:37:59 matt Exp $ | ||||||||||
| 2 | |||||||||||
| 3 | package Net::SenderBase::Results; | ||||||||||
| 4 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | ▶ | use vars qw($AUTOLOAD); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 0 | ▶ | sub cons { | ||||||||
|
Subroutine
cons: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 8 | 0 | my $class = shift; | |||||||||
| 9 | 0 | my ($ip, $data) = @_; | |||||||||
| 10 | |||||||||||
| 11 | 0 | my $self = bless {}, $class; | |||||||||
| 12 | |||||||||||
| 13 | 0 | $self->{ip} = $ip; | |||||||||
| 14 | 0 | $self->{raw_data} = $data; | |||||||||
| 15 | |||||||||||
| 16 | 0 | $self->parse_data; | |||||||||
| 17 | |||||||||||
| 18 | 0 | return $self; | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 4 | my %keys = ( | |||||||||
| 22 | 0 => 'version_number', | ||||||||||
| 23 | 1 => 'org_name', | ||||||||||
| 24 | 2 => 'org_daily_magnitude', | ||||||||||
| 25 | 3 => 'org_monthly_magnitude', | ||||||||||
| 26 | 4 => 'org_id', | ||||||||||
| 27 | 5 => 'org_category', | ||||||||||
| 28 | 6 => 'org_first_message', | ||||||||||
| 29 | 7 => 'org_domains_count', | ||||||||||
| 30 | 8 => 'org_ip_controlled_count', | ||||||||||
| 31 | 9 => 'org_ip_used_count', | ||||||||||
| 32 | 10 => 'org_fortune_1000', | ||||||||||
| 33 | |||||||||||
| 34 | 20 => 'hostname', | ||||||||||
| 35 | 21 => 'domain_name', | ||||||||||
| 36 | 22 => 'hostname_matches_ip', | ||||||||||
| 37 | 23 => 'domain_daily_magnitude', | ||||||||||
| 38 | 24 => 'domain_monthly_magnitude', | ||||||||||
| 39 | 25 => 'domain_first_message', | ||||||||||
| 40 | 26 => 'domain_rating', | ||||||||||
| 41 | |||||||||||
| 42 | 40 => 'ip_daily_magnitude', | ||||||||||
| 43 | 41 => 'ip_monthly_magnitude', | ||||||||||
| 44 | 43 => 'ip_average_magnitude', | ||||||||||
| 45 | 44 => 'ip_30_day_volume_percent', | ||||||||||
| 46 | 45 => 'ip_in_bonded_sender', | ||||||||||
| 47 | 46 => 'ip_cidr_range', | ||||||||||
| 48 | 47 => 'ip_blacklist_score', | ||||||||||
| 49 | |||||||||||
| 50 | 50 => 'ip_city', | ||||||||||
| 51 | 51 => 'ip_state', | ||||||||||
| 52 | 52 => 'ip_postal_code', | ||||||||||
| 53 | 53 => 'ip_country', | ||||||||||
| 54 | 54 => 'ip_longitude', | ||||||||||
| 55 | 55 => 'ip_latitude', | ||||||||||
| 56 | ); | ||||||||||
| 57 | |||||||||||
| 58 | 4 | my %methods = (ip => 1, raw_data => 1, reverse(%keys)); | |||||||||
| 59 | |||||||||||
| 60 | 0 | ▶ | sub parse_data { | ||||||||
|
Subroutine
parse_data: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 61 | 0 | my $self = shift; | |||||||||
| 62 | |||||||||||
| 63 | 0 | foreach my $part (split(/\|/, $self->{raw_data})) { | |||||||||
| 64 | 0 | my ($key, $value) = split(/=/, $part, 2); | |||||||||
| 65 | 0 | ▶ | if (exists($keys{$key})) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 66 | 0 | $self->{$keys{$key}} = $value; | |||||||||
| 67 | } | ||||||||||
| 68 | else { | ||||||||||
| 69 | # new key - please inform AUTHOR! | ||||||||||
| 70 | 0 | $self->{"key_$key"} = $value; | |||||||||
| 71 | } | ||||||||||
| 72 | } | ||||||||||
| 73 | } | ||||||||||
| 74 | |||||||||||
| 75 | 0 | ▶ | sub AUTOLOAD { | ||||||||
|
Subroutine
AUTOLOAD: not called CC=2 SCAR=17.9
| |||||||||||
| 76 | 0 | my $self = shift; | |||||||||
| 77 | 0 | my $method = $AUTOLOAD; | |||||||||
| 78 | 0 | $method =~ s/.*:://; | |||||||||
| 79 | 0 | ▶ | die "No such method: $method" unless exists($methods{$method}); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 80 | 0 | return $self->{$method}; | |||||||||
| 81 | } | ||||||||||
| 82 | |||||||||||
| 83 | 4 | 1; | |||||||||
| 84 | __END__ | ||||||||||