Re: [PATCH 4/4] remote-mediawiki: allow using (Main) as a namespace and skip special namespaces
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Oct 30, 2017, 03:52 UTC
- Message-ID
- <CAPig+cSMRG0_kPpgFv5hco9Lk9jfYmJm-+rkQaw6vNQTdoEg7Q@mail.gmail.com>
- In-Reply-To
- <87y3nt73uy.fsf@curie.anarc.at>
On Sun, Oct 29, 2017 at 10:43 PM, Antoine Beaupré <anarcat@debian.org> wrote:
Show 6 quoted lines
> On 2017-10-29 15:49:28, Eric Sunshine wrote: >> This may be problematic since get_mw_namespace_id() may return undef >> rather than a number, in which case Perl will complain. > > Actually, get_mw_namespace_id() doesn't seem like it can return undef - > did you mistake it with get_mw_namespace_id_for_page()?
Hmm, no. What I see in the function is this:
my $id;
...
if ($ns->{is_namespace}) {
$id = $ns->{id};
}
...
return $id;So, $id starts undefined and is assigned only conditionally before being returned, but perhaps I'm missing some subtlety.