print qq(BEGIN { \$/ = $fs; \$\\ = $bs; }\n);
}
my @BEGINs = B::begin_av->isa("B::AV") ? B::begin_av->ARRAY : ();
+ my @CHECKs = B::check_av->isa("B::AV") ? B::check_av->ARRAY : ();
my @INITs = B::init_av->isa("B::AV") ? B::init_av->ARRAY : ();
my @ENDs = B::end_av->isa("B::AV") ? B::end_av->ARRAY : ();
- for my $block (@BEGINs, @INITs, @ENDs) {
+ for my $block (@BEGINs, @CHECKs, @INITs, @ENDs) {
$self->todo($block, 0);
}
$self->stash_subs();
sub coderef2text {
my $self = shift;
my $sub = shift;
- croak "Usage: ->coderef2text(CODEREF)" unless ref($sub) eq "CODE";
+ croak "Usage: ->coderef2text(CODEREF)" unless UNIVERSAL::isa($sub, "CODE");
$self->init();
return $self->indent($self->deparse_sub(svref_2object($sub)));
sub pp_and { logop(@_, "and", 3, "&&", 11, "if") }
sub pp_or { logop(@_, "or", 2, "||", 10, "unless") }
+sub pp_dor { logop(@_, "err", 2, "//", 10, "") }
# xor is syntactically a logop, but it's really a binop (contrary to
# old versions of opcode.pl). Syntax is what matters here.
}
sub pp_andassign { logassignop(@_, "&&=") }
-sub pp_orassign { logassignop(@_, "||=") }
+sub pp_orassign { logassignop(@_, "||=") }
+sub pp_dorassign { logassignop(@_, "//=") }
sub listop {
my $self = shift;
sub pp_null {
my $self = shift;
- my($op, $cx) = @_;
+ my($op, $cx, $flags) = @_;
if (class($op) eq "OP") {
# old value is lost
return $self->{'ex_const'} if $op->targ == OP_CONST;
. $self->deparse($op->first->sibling, 20),
$cx, 20);
} elsif ($op->flags & OPf_SPECIAL && $cx == 0 && !$op->targ) {
- return "do {\n\t". $self->deparse($op->first, $cx) ."\n\b};";
+ if ($flags) {
+ return $self->deparse($op->first, $cx);
+ }
+ else {
+ return "do {\n\t". $self->deparse($op->first, $cx) ."\n\b};";
+ }
} elsif (!null($op->first->sibling) and
$op->first->sibling->name eq "null" and
class($op->first->sibling) eq "UNOP" and
| \\[uUlLQE]
)
- /length($4) ? "$1$2$4" : "$1$2\\$3"/xeg;
+ /defined($4) && length($4) ? "$1$2$4" : "$1$2\\$3"/xeg;
return $str;
}
| \\[uUlLQE]
)
- /length($4) ? "$1$2$4" : "$1$2\\$3"/xeg;
+ /defined($4) && length($4) ? "$1$2$4" : "$1$2\\$3"/xeg;
return $str;
}
$flags .= "e";
}
if ($op->pmflags & PMf_EVAL) {
- $repl = $self->deparse($repl, 0);
+ $repl = $self->deparse($repl, 0, 1);
} else {
$repl = $self->dq($repl);
}