As stated in the previous change, conditional hash assignments
which trigger other hash assignments seem problematic, at times.
So replace:
$h->{k} //= do { $h->{x} = ...; $val };
$h->{k} // do {
$h->{x} = ...;
$hk->{k} = $val
};
"||=" is affected the same way, and some instances of "||=" are
replaced with "//=" or "// do {", now.
sub repo_objs {
my ($self, $ibxish) = @_;
sub repo_objs {
my ($self, $ibxish) = @_;
- my $ibx_code_repos = $ibxish->{coderepo} or return;
- $ibxish->{-repo_objs} //= do {
+ my $ibx_code_repos = $ibxish->{coderepo} // return;
+ $ibxish->{-repo_objs} // do {
my $code_repos = $self->{-code_repos};
my @repo_objs;
for my $nick (@$ibx_code_repos) {
my $code_repos = $self->{-code_repos};
my @repo_objs;
for my $nick (@$ibx_code_repos) {
push @repo_objs, $repo if $repo;
}
if (scalar @repo_objs) {
push @repo_objs, $repo if $repo;
}
if (scalar @repo_objs) {
+ $ibxish ->{-repo_objs} = \@repo_objs;
} else {
delete $ibxish->{coderepo};
} else {
delete $ibxish->{coderepo};
sub git_path ($$) {
my ($self, $path) = @_;
sub git_path ($$) {
my ($self, $path) = @_;
- $self->{-git_path}->{$path} ||= do {
+ $self->{-git_path}->{$path} //= do {
local $/ = "\n";
chomp(my $str = $self->qx(qw(rev-parse --git-path), $path));
local $/ = "\n";
chomp(my $str = $self->qx(qw(rev-parse --git-path), $path));
# prepares an index for BODY[$SECTION_IDX] fetches
sub eml_body_idx ($$) {
my ($eml, $section_idx) = @_;
# prepares an index for BODY[$SECTION_IDX] fetches
sub eml_body_idx ($$) {
my ($eml, $section_idx) = @_;
- my $idx = $eml->{imap_all_parts} //= do {
+ my $idx = $eml->{imap_all_parts} // do {
my $all = {};
$eml->each_part(\&eml_index_offs_i, $all, 0, 1);
# top-level of multipart, BODY[0] not allowed (nz-number)
delete $all->{0};
my $all = {};
$eml->each_part(\&eml_index_offs_i, $all, 0, 1);
# top-level of multipart, BODY[0] not allowed (nz-number)
delete $all->{0};
+ $eml->{imap_all_parts} = $all;
};
$idx->{$section_idx};
}
};
$idx->{$section_idx};
}
sub _set_limiter ($$$) {
my ($self, $pi_cfg, $pfx) = @_;
my $lkey = "-${pfx}_limiter";
sub _set_limiter ($$$) {
my ($self, $pi_cfg, $pfx) = @_;
my $lkey = "-${pfx}_limiter";
- $self->{$lkey} ||= do {
+ $self->{$lkey} //= do {
# full key is: publicinbox.$NAME.httpbackendmax
my $mkey = $pfx.'max';
my $val = $self->{$mkey} or return;
# full key is: publicinbox.$NAME.httpbackendmax
my $mkey = $pfx.'max';
my $val = $self->{$mkey} or return;
sub ale {
my ($self) = @_;
sub ale {
my ($self) = @_;
require PublicInbox::LeiALE;
require PublicInbox::LeiALE;
- $self->_lei_cfg(1)->{ale} //= PublicInbox::LeiALE->new($self);
+ my $cfg = $self->_lei_cfg(1);
+ $self->{ale} = $cfg->{ale} //= PublicInbox::LeiALE->new($self);
sub event_step_init {
my ($self) = @_;
my $sock = $self->{sock} or return;
sub event_step_init {
my ($self) = @_;
my $sock = $self->{sock} or return;
- $self->{-event_init_done} //= do { # persist til $ops done
+ $self->{-event_init_done} // do { # persist til $ops done
$sock->blocking(0);
$self->SUPER::new($sock, EPOLLIN);
$sock->blocking(0);
$self->SUPER::new($sock, EPOLLIN);
+ $self->{-event_init_done} = $sock;
sub dbh {
my ($self, $lock) = @_;
sub dbh {
my ($self, $lock) = @_;
my $f = $self->{filename};
$lock //= $self->lock_for_scope_fast;
my $dbh = DBI->connect("dbi:SQLite:dbname=$f", '', '', {
my $f = $self->{filename};
$lock //= $self->lock_for_scope_fast;
my $dbh = DBI->connect("dbi:SQLite:dbname=$f", '', '', {
sub news_www {
my ($self) = @_;
sub news_www {
my ($self) = @_;
- $self->{news_www} ||= do {
+ $self->{news_www} //= do {
require PublicInbox::NewsWWW;
PublicInbox::NewsWWW->new($self->{pi_cfg});
}
require PublicInbox::NewsWWW;
PublicInbox::NewsWWW->new($self->{pi_cfg});
}
sub cgit {
my ($self) = @_;
sub cgit {
my ($self) = @_;
my $pi_cfg = $self->{pi_cfg};
if (defined($pi_cfg->{'publicinbox.cgitrc'})) {
my $pi_cfg = $self->{pi_cfg};
if (defined($pi_cfg->{'publicinbox.cgitrc'})) {
sub path_info_raw ($) {
my ($env) = @_;
my $sn = $env->{SCRIPT_NAME};
sub path_info_raw ($) {
my ($env) = @_;
my $sn = $env->{SCRIPT_NAME};
- my $re = $path_re_cache{$sn} ||= do {
+ my $re = $path_re_cache{$sn} //= do {
$sn = '/'.$sn unless index($sn, '/') == 0;
$sn =~ s!/\z!!;
qr!\A(?:https?://[^/]+)?\Q$sn\E(/[^\?\#]+)!;
$sn = '/'.$sn unless index($sn, '/') == 0;
$sn =~ s!/\z!!;
qr!\A(?:https?://[^/]+)?\Q$sn\E(/[^\?\#]+)!;
'Content-Length' => undef ];
bless $ctx, __PACKAGE__;
$ctx->{gz} = PublicInbox::GzipFilter::gz_or_noop($res_hdr, $ctx->{env});
'Content-Length' => undef ];
bless $ctx, __PACKAGE__;
$ctx->{gz} = PublicInbox::GzipFilter::gz_or_noop($res_hdr, $ctx->{env});
- $ctx->{base_url} //= do {
+ $ctx->{base_url} // do {
$ctx->zmore(html_top($ctx));
$ctx->zmore(html_top($ctx));
+ $ctx->{base_url} = base_url($ctx);
};
$ctx->zmore($$sref) if $sref;
my $bdy = $ctx->zflush(_html_end($ctx));
};
$ctx->zmore($$sref) if $sref;
my $bdy = $ctx->zflush(_html_end($ctx));