| 1 | package CPAN::Testers::WWW::Reports::Report; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | use vars qw($VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | $VERSION = '0.05'; | |||||||||
| 8 | |||||||||||
| 9 | #---------------------------------------------------------------------------- | ||||||||||
| 10 | # Library Modules | ||||||||||
| 11 | |||||||||||
| 12 | 2 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 2 | our $AUTOLOAD; | |||||||||
| 14 | |||||||||||
| 15 | #---------------------------------------------------------------------------- | ||||||||||
| 16 | # Variables | ||||||||||
| 17 | |||||||||||
| 18 | 2 | my @methods = ( | |||||||||
| 19 | "ostext", "osvers", "perl", "platform", | ||||||||||
| 20 | "version", "csspatch", "distversion", "id", | ||||||||||
| 21 | "status", "state", "cssperl", "dist", | ||||||||||
| 22 | "distribution", "osname", "guid", "grade", | ||||||||||
| 23 | "archname", "action", "url" | ||||||||||
| 24 | ); | ||||||||||
| 25 | 2 | my %permitted_methods = map { $_ => 1 } @methods; | |||||||||
| 26 | |||||||||||
| 27 | #---------------------------------------------------------------------------- | ||||||||||
| 28 | # The Application Programming Interface | ||||||||||
| 29 | |||||||||||
| 30 | sub new { | ||||||||||
| 31 | 1 | ▶ | my ( $class, $self ) = @_; | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 32 | |||||||||||
| 33 | 1 | bless $self, 'CPAN::Testers::WWW::Reports::Report'; | |||||||||
| 34 | |||||||||||
| 35 | 1 | $self->{_permitted} = \%permitted_methods; | |||||||||
| 36 | |||||||||||
| 37 | 1 | return $self; | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | ▶ | sub DESTROY {} | |||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=0.0
| |||||||||||
| 41 | |||||||||||
| 42 | sub AUTOLOAD { | ||||||||||
| 43 | 1 | ▶ | my $self = shift; | ||||||||
|
Subroutine
AUTOLOAD: called CC=4 SCAR=15.2
| |||||||||||
| 44 | 1 | ▶ | my $type = ref($self) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | or croak "$self is not an object"; | ||||||||||
| 46 | |||||||||||
| 47 | 1 | my $name = $AUTOLOAD; | |||||||||
| 48 | 1 | $name =~ s/.*://; # strip fully-qualified portion | |||||||||
| 49 | |||||||||||
| 50 | 1 | ▶ | unless ( exists $self->{_permitted}->{$name} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | 0 | croak "Can't access `$name' field in class $type"; | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 1 | ▶ | if (@_) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | 0 | return $self->{$name} = shift; | |||||||||
| 56 | } else { | ||||||||||
| 57 | 1 | return $self->{$name}; | |||||||||
| 58 | } | ||||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 2 | 1; | |||||||||
| 62 | |||||||||||
| 63 | __END__ | ||||||||||