| 1 | package Mail::Abuse::Reader; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 21 | require 5.005_62; | |||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 21 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 21 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 21 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | # The code below should be in a single line | ||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 21 | our $VERSION = do { my @r = (q$Revision: 1.5 $ =~ /\d+/g); sprintf " %d."."%03d" x $#r, @r }; | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | =pod | ||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | =head1 NAME | ||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | Mail::Abuse::Reader - Reads a Mail::Abuse::Report | ||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | =head1 SYNOPSIS | ||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | package Mail::Abuse::Reader::MyReader; | ||||||||||||||||||||
| 22 | use Mail::Abuse::Reader; | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | use base 'Mail::Abuse::Reader'; | ||||||||||||||||||||
| 25 | sub read { ... } | ||||||||||||||||||||
| 26 | package main; | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | use Mail::Abuse::Report; | ||||||||||||||||||||
| 29 | my $r = new Mail::Abuse::Reader::MyReader; | ||||||||||||||||||||
| 30 | my $report = new Mail::Abuse::Report (reader => $r); | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | =head1 DESCRIPTION | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | This class implements the reception of an abuse report and its | ||||||||||||||||||||
| 35 | conversion to a C<Mail::Abuse::Report> object. | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | The following functions are provided for the customization of the | ||||||||||||||||||||
| 38 | behavior of the class. | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | =cut | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | sub new | ||||||||||||||||||||
| 43 | 42 | ▶ | { | ||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||
| 44 | 42 | my $type = shift; | |||||||||||||||||||
| 45 | 42 | ▶ | my $class = ref($type) || $type; | ||||||||||||||||||
|
Condition33%1/3
ref $type || $type
MC/DC0%0/2
ref $type || $type
ref $type
$type
Truth table33%1/3
A || B
A= ref $typeB= $type
| |||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | 42 | ▶ | croak "Invalid call to Mail::Abuse::Reader::new" | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 48 | unless $class; | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 42 | bless {}, $class; | |||||||||||||||||||
| 51 | } | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | =pod | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | =over | ||||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | =item C<read($report)> | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | Populates the text of the given C<$report> using the C<-E<gt>text> | ||||||||||||||||||||
| 60 | method. Must return true if succesful or false otherwise. | ||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | =cut | ||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | sub read | ||||||||||||||||||||
| 65 | 0 | ▶ | { | ||||||||||||||||||
|
Subroutine
read: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 66 | 0 | croak "Mail::Abuse::Reader is a virtual class"; | |||||||||||||||||||
| 67 | } | ||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | # This AUTOLOAD magic provides automatic | ||||||||||||||||||||
| 70 | # accessors | ||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | sub AUTOLOAD | ||||||||||||||||||||
| 73 | 15 | ▶ | { | ||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 74 | 21 | ▶ | no strict "refs"; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 75 | 21 | ▶ | use vars qw($AUTOLOAD); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 76 | 15 | my $method = $AUTOLOAD; | |||||||||||||||||||
| 77 | 15 | $method =~ s/^.*:://; | |||||||||||||||||||
| 78 | *$method = sub | ||||||||||||||||||||
| 79 | 48 | ▶ | { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.9
| |||||||||||||||||||||
| 80 | 48 | my $self = shift; | |||||||||||||||||||
| 81 | 48 | my $ret = $self->{$method}; | |||||||||||||||||||
| 82 | 48 | ▶ | if (@_) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 83 | { | ||||||||||||||||||||
| 84 | 0 | $ret = $self->{$method}; | |||||||||||||||||||
| 85 | 0 | $self->{$method} = shift; | |||||||||||||||||||
| 86 | } | ||||||||||||||||||||
| 87 | 48 | return $ret; | |||||||||||||||||||
| 88 | 15 | }; | |||||||||||||||||||
| 89 | 15 | goto \&$method; | |||||||||||||||||||
| 90 | } | ||||||||||||||||||||
| 91 | |||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | __END__ | ||||||||||||||||||||