MethodMaker.pm

filter: Statementstmt 79.7% 71 / 89 Branchbran 62.8% 83 / 132 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 73.8% 48 / 65 Podpod 0.0% 0 / 63 totaltotal 57.6% 203 / 352 CC 70 SCAR 9.6
CC
70
Cov
70%
import
9.9
abbrev_table_address
2.2
attribute_bytes
2.2
CRAP 2.6
« ZStatus.pm ↑ Summary ZObject.pm »
1 package Games::Rezrov::MethodMaker;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 my %TOTALS;
6  
7 6 ▶sub import {
Subroutine import: called CC=8 SCAR=22.9
8 6 my ($package, @names) = @_;
9  
10 6 my $caller = scalar caller();
11 6 my $buffer = sprintf "\{ package %s;\n", $caller;
12 6 my $type = 0;
13  
14 6 my $count = 0;
15 6 ▶ if (ref $names[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $names[0]) 3 3 6
16 3 my $ref = shift @names;
17 3 ▶ if (ref $ref eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ref eq 'ARRAY') { } 3 0 3
18 3 $type = 1;
19 3 ▶ $count = $ref->[0] || 0;
Condition50%1/2
$ref->[0] || 0
l!l
03
MC/DC0%0/1
$ref->[0] || 0
$ref->[0]
Truth table50%1/2
A
A= $ref->[0]
Aresult
11
00
20 # printf STDERR "%s sc: $count\n", scalar caller;
21 } else {
22 0 die "huh?";
23 }
24 }
25  
26 6 ▶ if ($type == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type == 1) { } 3 3 6
27 #
28 # blessed array style
29 #
30 3 foreach (@names) {
31 44 $buffer .= sprintf '
32 sub %s {
33 return(defined $_[1] ? $_[0]->[%d] = $_[1] : $_[0]->[%d]);
34 }
35 ', $_, $count, $count;
36 44 $count++;
37 }
38 } else {
39 #
40 # blessed hash style
41 #
42 3 foreach (@names) {
43 18 $buffer .= sprintf '
44 sub %s {
45 return(defined $_[1] ? $_[0]->{"%s"} = $_[1] : $_[0]->{"%s"});
46 }
47 ', $_, $_, $_;
48 }
49 }
50 6 $buffer .= "\n\}\n";
51  
52 #print STDERR $buffer;
53 0 ▶ eval $buffer;
Subroutine abbrev_table_address: called CC=2 SCAR=7.7
Subroutine attribute_bytes: called CC=2 SCAR=7.7
Subroutine attribute_starter: called CC=2 SCAR=7.7
Subroutine bp_cheat_data: called CC=2 SCAR=7.7
Subroutine current_window: called CC=2 SCAR=7.7
Subroutine decoded_by_address: called CC=2 SCAR=7.7
Subroutine decoded_by_word: called CC=2 SCAR=7.7
Subroutine dictionary_address: called CC=2 SCAR=7.7
Subroutine dictionary_fully_decoded: called CC=2 SCAR=7.7
Subroutine dictionary_word_start: called CC=2 SCAR=7.7
Subroutine encoded_word_length: called CC=2 SCAR=7.7
Subroutine encoded_word_length: called CC=2 SCAR=7.7
Subroutine entry_count: called CC=2 SCAR=7.7
Subroutine entry_length: called CC=2 SCAR=7.7
Subroutine file_checksum: called CC=2 SCAR=7.7
Subroutine file_length: called CC=2 SCAR=7.7
Subroutine first_instruction_address: called CC=2 SCAR=7.7
Subroutine global_variable_address: called CC=2 SCAR=7.7
Subroutine hours: called CC=2 SCAR=7.7
Subroutine in_current_room: not called CC=2 SCAR=7.7
Subroutine in_inventory: not called CC=2 SCAR=7.7
Subroutine is_current_room: called CC=2 SCAR=7.7
Subroutine is_player: called CC=2 SCAR=7.7
Subroutine is_time_game: called CC=2 SCAR=7.7
Subroutine is_toplevel_child: called CC=2 SCAR=7.7
Subroutine last_random: not called CC=2 SCAR=7.7
Subroutine listening: not called CC=2 SCAR=7.7
Subroutine location: not called CC=2 SCAR=7.7
Subroutine max_objects: called CC=2 SCAR=7.7
Subroutine max_properties: called CC=2 SCAR=7.7
Subroutine minutes: called CC=2 SCAR=7.7
Subroutine moves: called CC=2 SCAR=7.7
Subroutine object_bytes: called CC=2 SCAR=7.7
Subroutine object_cache: not called CC=2 SCAR=7.7
Subroutine object_count: called CC=2 SCAR=7.7
Subroutine object_table_address: called CC=2 SCAR=7.7
Subroutine paged_memory_address: called CC=2 SCAR=7.7
Subroutine parent_room: called CC=2 SCAR=7.7
Subroutine pointer_size: called CC=2 SCAR=7.7
Subroutine recog_dictionary_setup: not called CC=2 SCAR=7.7
Subroutine recognized_phrases: not called CC=2 SCAR=7.7
Subroutine release_number: called CC=2 SCAR=7.7
Subroutine routines_offset: not called CC=2 SCAR=7.7
Subroutine score: called CC=2 SCAR=7.7
Subroutine score_game: called CC=2 SCAR=7.7
Subroutine separators: called CC=2 SCAR=7.7
Subroutine serial_code: called CC=2 SCAR=7.7
Subroutine speaking: called CC=2 SCAR=7.7
Subroutine speech_recognition_error: not called CC=2 SCAR=7.7
Subroutine speech_synthesis_error: not called CC=2 SCAR=7.7
Subroutine static_memory_address: called CC=2 SCAR=7.7
Subroutine story: not called CC=2 SCAR=7.7
Subroutine strings_offset: not called CC=2 SCAR=7.7
Subroutine time_game: called CC=2 SCAR=7.7
Subroutine toplevel_child: called CC=2 SCAR=7.7
Subroutine using_term_readline: not called CC=2 SCAR=7.7
Subroutine version: called CC=2 SCAR=7.7
Subroutine version: called CC=2 SCAR=7.7
Subroutine voice_dictation: not called CC=2 SCAR=7.7
Subroutine voicetext: not called CC=2 SCAR=7.7
Subroutine zio_options: called CC=2 SCAR=7.7
Subroutine ztext: called CC=2 SCAR=7.7
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Branch: 62 branches
BranchTrueFalseTotal
defined $_[1] ? : 1 190 191
defined $_[1] ? : 1 206 207
defined $_[1] ? : 1 206 207
defined $_[1] ? : 1 4 5
defined $_[1] ? : 4 0 4
defined $_[1] ? : 1 2 3
defined $_[1] ? : 1 12 13
defined $_[1] ? : 1 1 2
defined $_[1] ? : 4 4 8
defined $_[1] ? : 1 2 3
defined $_[1] ? : 1 1 2
defined $_[1] ? : 1 15 16
defined $_[1] ? : 1 2 3
defined $_[1] ? : 1 2 3
defined $_[1] ? : 1 4 5
defined $_[1] ? : 1 1024 1025
defined $_[1] ? : 1 1 2
defined $_[1] ? : 1 2 3
defined $_[1] ? : 1 0 1
defined $_[1] ? : 0 0 0
defined $_[1] ? : 0 0 0
defined $_[1] ? : 70 0 70
defined $_[1] ? : 70 0 70
defined $_[1] ? : 1 1 2
defined $_[1] ? : 70 0 70
defined $_[1] ? : 0 0 0
defined $_[1] ? : 0 0 0
defined $_[1] ? : 0 0 0
defined $_[1] ? : 1 8 9
defined $_[1] ? : 1 1 2
defined $_[1] ? : 1 0 1
defined $_[1] ? : 1 0 1
defined $_[1] ? : 1 206 207
defined $_[1] ? : 0 0 0
defined $_[1] ? : 1 0 1
defined $_[1] ? : 1 12 13
defined $_[1] ? : 1 0 1
defined $_[1] ? : 1 70 71
defined $_[1] ? : 1 206 207
defined $_[1] ? : 0 0 0
defined $_[1] ? : 0 0 0
defined $_[1] ? : 1 6 7
defined $_[1] ? : 0 0 0
defined $_[1] ? : 1 0 1
defined $_[1] ? : 2 0 2
defined $_[1] ? : 1 4 5
defined $_[1] ? : 1 4 5
defined $_[1] ? : 0 20 20
defined $_[1] ? : 0 0 0
defined $_[1] ? : 0 0 0
defined $_[1] ? : 1 5 6
defined $_[1] ? : 0 0 0
defined $_[1] ? : 0 0 0
defined $_[1] ? : 1 0 1
defined $_[1] ? : 1 0 1
defined $_[1] ? : 0 0 0
defined $_[1] ? : 1 2 3
defined $_[1] ? : 1 8 9
defined $_[1] ? : 0 0 0
defined $_[1] ? : 0 0 0
defined $_[1] ? : 2 0 2
defined $_[1] ? : 1 2 3
54  
55 6 $TOTALS{$caller} = $count;
56
57 6 ▶ die "yikes: $buffer" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 6 6
58 }
59  
60 0 ▶sub get_count {
Subroutine get_count: not called CC=1 SCAR=6.9
Pod undocumented
61 # return count of methods built; for array style, returns next
62 # available index
63 0 return $TOTALS{scalar caller()};
64 }
65  
66 1 1;
« ZStatus.pm ↑ Summary ZObject.pm »