| 1 | package DBomb::Generator; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | DBomb::Generator - Provides routines any generator might need. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | our $VERSION = '$Revision: 1.4 $'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use Carp::Assert; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use base qw(Exporter); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | use Class::MethodMaker | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | 'new_with_init' => 'new'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | our @EXPORT_OK = qw(gen_accessor); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | ## subroutine -- not a method! | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | ## gen_accessor($pkg, $sub_name) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | ## gen_accessor($pkg, $sub_name, $attr_name) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | sub gen_accessor | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gen_accessor: not called CC=5 SCAR=30.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | my ($pkg, $sub_name, $attr_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | assert(2 <= @_ && @_ <= 3 && defined($pkg) && defined($sub_name), 'valid parameters'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/9
2 <= @_ && @_ <= 3 && defined $pkg && defined $sub_name
2 <= @_ and @_ <= 3 and defined $pkg
2 <= @_ and @_ <= 3
MC/DC0%0/4
2 <= @_ && @_ <= 3 && defined $pkg && defined $sub_name
2 <= @_
@_ <= 3
defined $pkg
defined $sub_name
Truth table0%0/5
A and B and C && D
A= 2 <= @_B= @_ <= 3C= defined $pkgD= defined $sub_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | $attr_name = $sub_name if not defined $attr_name; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | *{$pkg . "::" . $sub_name} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | $_[0]->{$attr_name} = $_[1] if @_ > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | $_[0]->{$attr_name} | |||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||