Branch Coverage

lib/Class/MethodMaker/OptExt.pm
Criterion Covered Total %
branch 8 14 57.1


line true false branch
240 0 55 unless defined $code
245 70 425 if exists $$code{$_}
337 0 60 if (grep(($_ > 1), @check))
346 56 4 if (grep(($_ eq $type), ('scalar', 'array', 'hash')))
349 55 10 if exists {DEFAULT => {asgnchk => '', decl => '', defchk => '', postac => '', predefchk => '', read => ['__VALUE__', ''], refer => '$_[0]->{$name}', reset => '', store => ''}, default => {defchk => "if ( ! exists %%STORAGE%% ) {\n %%ASGNCHK__SIGIL__(\$default)%%\n %%STORAGE%% = \$default\n}\n", encode => 4}, default_ctor => {defchk => "if ( ! exists %%STORAGE%% ) {\n my \$default = \$dctor->(\$_[0]);\n %%ASGNCHK__SIGIL__(\$default)%%\n %%STORAGE%% = \$default\n}\n", encode => 8}, read_cb => {encode => 64, read => ["{ # Encapsulate scope to avoid redefined \$v issues\n my \$v = __VALUE__;\n \$v = \$_->(\$_[0], \$v)\n for \@read_callbacks;\n \$v;\n}\n", "{ # Encapsulate scope to avoid redefined \$v issues\n my \$v = __VALUE__;\n \$v = \$_->(\$_[0], \$v)\n for \@read_callbacks;\n \$v;\n}\n"]}, static => {decl => 'my @store;', encode => 1, refer => '$store[0]'}, store_cb => {encode => 128, store => "my __NAME__ = __VALUE__;\nif ( exists %%STORAGE%% ) {\n my \$old = %%STORAGE%%;\n __NAMEREF__ = \$_->(\$_[0], __NAMEREF__, \$name, \$old) %%V2ONLY%%\n __NAMEREF__ = \$_->(\$_[0], __NAMEREF__, \$name, \$old, __ALL__) %%V1COMPAT%%\n for \@store_callbacks;\n} else {\n __NAMEREF__ = \$_->(\$_[0], __NAMEREF__, \$name) %%V2ONLY%%\n __NAMEREF__ = \$_->(\$_[0], __NAMEREF__, \$name, undef, __ALL__) %%V1COMPAT%%\n for \@store_callbacks;\n}\n"}, tie_class => {encode => 16, postac => "tie %%STORAGE(__SIGIL__)%%, \$tie_class, \@tie_args\n unless exists %%STORAGE%%;\n", predefchk => "tie %%STORAGE(__SIGIL__)%%, \$tie_class, \@tie_args\n unless exists %%STORAGE%%;\n", reset => "untie %%STORAGE(__SIGIL__)%%;\n"}, type => {asgnchk => qq[for (__FOO__) {\n croak(sprintf("Incorrect type for attribute __ATTR__: %s\\n" .\n " : should be '%s' (or subclass thereof)\\n",\n (defined(\$_) ?\n (ref(\$_) ? ref(\$_) : "plain value(-->\$_<--)" ) :\n '*undef*'\n ), \$type))\n unless ! defined \$_ or UNIVERSAL::isa(\$_, \$type);\n}\n], encode => 2}, typex => {asgnchk => qq[for (__FOO__) {\n# \$_ += 0;\n# croak(sprintf("Incorrect type for attribute __ATTR__: %s\\n" .\n# " : should be '%s' (or subclass thereof)\\n",\n# (defined(\$_) ?\n# (ref(\$_) ? ref(\$_) : "plain value(-->\$_<--)" ) :\n# '*undef*'\n# ), \$typex))\n# unless ! defined \$_ or UNIVERSAL::isa(\$_, \$typex);\n}\n], encode => 256}, v1_compat => {encode => 32}}->{$_}
371 0 0 unless (defined $code)
372 0 0 if (exists {DEFAULT => {asgnchk => '', decl => '', defchk => '', postac => '', predefchk => '', read => ['__VALUE__', ''], refer => '$_[0]->{$name}', reset => '', store => ''}, default => {defchk => "if ( ! exists %%STORAGE%% ) {\n %%ASGNCHK__SIGIL__(\$default)%%\n %%STORAGE%% = \$default\n}\n", encode => 4}, default_ctor => {defchk => "if ( ! exists %%STORAGE%% ) {\n my \$default = \$dctor->(\$_[0]);\n %%ASGNCHK__SIGIL__(\$default)%%\n %%STORAGE%% = \$default\n}\n", encode => 8}, read_cb => {encode => 64, read => ["{ # Encapsulate scope to avoid redefined \$v issues\n my \$v = __VALUE__;\n \$v = \$_->(\$_[0], \$v)\n for \@read_callbacks;\n \$v;\n}\n", "{ # Encapsulate scope to avoid redefined \$v issues\n my \$v = __VALUE__;\n \$v = \$_->(\$_[0], \$v)\n for \@read_callbacks;\n \$v;\n}\n"]}, static => {decl => 'my @store;', encode => 1, refer => '$store[0]'}, store_cb => {encode => 128, store => "my __NAME__ = __VALUE__;\nif ( exists %%STORAGE%% ) {\n my \$old = %%STORAGE%%;\n __NAMEREF__ = \$_->(\$_[0], __NAMEREF__, \$name, \$old) %%V2ONLY%%\n __NAMEREF__ = \$_->(\$_[0], __NAMEREF__, \$name, \$old, __ALL__) %%V1COMPAT%%\n for \@store_callbacks;\n} else {\n __NAMEREF__ = \$_->(\$_[0], __NAMEREF__, \$name) %%V2ONLY%%\n __NAMEREF__ = \$_->(\$_[0], __NAMEREF__, \$name, undef, __ALL__) %%V1COMPAT%%\n for \@store_callbacks;\n}\n"}, tie_class => {encode => 16, postac => "tie %%STORAGE(__SIGIL__)%%, \$tie_class, \@tie_args\n unless exists %%STORAGE%%;\n", predefchk => "tie %%STORAGE(__SIGIL__)%%, \$tie_class, \@tie_args\n unless exists %%STORAGE%%;\n", reset => "untie %%STORAGE(__SIGIL__)%%;\n"}, type => {asgnchk => qq[for (__FOO__) {\n croak(sprintf("Incorrect type for attribute __ATTR__: %s\\n" .\n " : should be '%s' (or subclass thereof)\\n",\n (defined(\$_) ?\n (ref(\$_) ? ref(\$_) : "plain value(-->\$_<--)" ) :\n '*undef*'\n ), \$type))\n unless ! defined \$_ or UNIVERSAL::isa(\$_, \$type);\n}\n], encode => 2}, typex => {asgnchk => qq[for (__FOO__) {\n# \$_ += 0;\n# croak(sprintf("Incorrect type for attribute __ATTR__: %s\\n" .\n# " : should be '%s' (or subclass thereof)\\n",\n# (defined(\$_) ?\n# (ref(\$_) ? ref(\$_) : "plain value(-->\$_<--)" ) :\n# '*undef*'\n# ), \$typex))\n# unless ! defined \$_ or UNIVERSAL::isa(\$_, \$typex);\n}\n], encode => 256}, v1_compat => {encode => 32}}->{'DEFAULT'}{$codepoint}) { }