| 1 | package Attribute::Constructor; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 1 | ▶ | use 5.006; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 1 | ▶ | use Attribute::Handlers; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 1 | our $VERSION = '0.04'; | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 1 | ▶ | sub UNIVERSAL::Constructor : ATTR(CODE) { | ||||||||||||||||||
|
Subroutine
Constructor: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 12 | 1 | my ($package, $symbol, $referent, $attr, $data) = @_; | |||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 1 | ▶ | no warnings 'redefine'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 15 | 1 | ▶ | *{$symbol} = sub { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 2 | my $self = shift; | |||||||||||||||||||
| 18 | 2 | ▶ | my $class = ref($self) || $self; | ||||||||||||||||||
|
Condition66%2/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table66%2/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||
| 19 | 2 | my $instance = {}; | |||||||||||||||||||
| 20 | 2 | bless( $instance, $class ); | |||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | # Run the constructor | ||||||||||||||||||||
| 23 | 2 | $referent->( $instance, @_ ); | |||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | # Return the new object | ||||||||||||||||||||
| 26 | 2 | return $instance; | |||||||||||||||||||
| 27 | } | ||||||||||||||||||||
| 28 | 1 | ▶ | } | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 1 | 1; | |||||||||||||||||||
| 31 | __END__ | ||||||||||||||||||||