| 1 | package POE::Component::SmokeBox::Smoker; | ||||||||||||||||||||||||||||
| 2 | 24 | $POE::Component::SmokeBox::Smoker::VERSION = '0.56'; | |||||||||||||||||||||||||||
| 3 | #ABSTRACT: encapsulates a smoker object. | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 24 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 24 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 24 | ▶ | use Params::Check qw(check); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 24 | ▶ | use base qw(Object::Accessor); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 24 | ▶ | use vars qw($VERBOSE); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | sub new { | ||||||||||||||||||||||||||||
| 12 | 54 | ▶ | my $package = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=12.8
Pod
documented
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | my $tmpl = { | ||||||||||||||||||||||||||||
| 15 | perl => { defined => 1, required => 1 }, | ||||||||||||||||||||||||||||
| 16 | 0 | ▶ | env => { defined => 1, allow => [ sub { return 1 if ref $_[0] eq 'HASH'; } ], }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 17 | 4 | ▶ | do_callback => { allow => sub { return 1 if ! defined $_[0] or $_[0]->isa( 'CODE' ); }, }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=14.2
Branch: 1 branch
Condition33%1/3
not defined $_[0] or $_[0]->isa("CODE")
MC/DC0%0/2
not defined $_[0] or $_[0]->isa("CODE")
not defined $_[0]
$_[0]->isa("CODE")
Truth table33%1/3
not(A) or B
A= not defined $_[0]B= $_[0]->isa("CODE")
| |||||||||||||||||||||||||||||
| 18 | 2 | ▶ | name => { allow => sub { return 1; }, }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 54 | }; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 54 | ▶ | my $args = check( $tmpl, { @_ }, 1 ) or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 22 | 54 | my $self = bless { }, $package; | |||||||||||||||||||||||||||
| 23 | my $accessor_map = { | ||||||||||||||||||||||||||||
| 24 | 54 | ▶ | perl => sub { defined $_[0]; }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | env => sub { return 1 if ref $_[0] eq 'HASH'; }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | 4 | ▶ | do_callback => sub { return 1 if ! defined $_[0] or $_[0]->isa( 'CODE' ) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=14.2
Branch: 1 branch
Condition33%1/3
not defined $_[0] or $_[0]->isa("CODE")
MC/DC0%0/2
not defined $_[0] or $_[0]->isa("CODE")
not defined $_[0]
$_[0]->isa("CODE")
Truth table33%1/3
not(A) or B
A= not defined $_[0]B= $_[0]->isa("CODE")
| |||||||||||||||||||||||||||||
| 27 | 2 | ▶ | name => sub { return 1; }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 28 | 54 | }; | |||||||||||||||||||||||||||
| 29 | 54 | $self->mk_accessors( $accessor_map ); | |||||||||||||||||||||||||||
| 30 | 54 | $self->$_( $args->{$_} ) for keys %{ $args }; | |||||||||||||||||||||||||||
| 31 | 54 | return $self; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | sub dump_data { | ||||||||||||||||||||||||||||
| 35 | 85 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
dump_data: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 36 | 85 | my @returns = qw(perl); | |||||||||||||||||||||||||||
| 37 | 85 | foreach my $data ( qw( env do_callback ) ) { | |||||||||||||||||||||||||||
| 38 | 170 | ▶ | push @returns, $data if defined $self->$data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | 85 | return map { ( $_ => $self->$_ ) } @returns; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 24 | 1; | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | __END__ | ||||||||||||||||||||||||||||