A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Perl/perl5/issues/22365 below:

chdir doesn't return a boolean, but manual says it returns true/false · Issue #22365 · Perl/perl5 · GitHub

Description

According to perldoc -f chdir:

It returns true on success, false otherwise.

However, chdir actually returns (integer) 1 and 0. This is mostly observable in the failure case, which (according to the documentation) should return a value that is eq "", but isn't.

Steps to Reproduce

$ perl -wE 'say chdir "/invalid*"'
0
$ perl -Mexperimental=builtin -wE 'say builtin::is_bool chdir "/invalid*"'

$

Expected behavior

$ perl -wE 'say chdir "/invalid*"'

$ perl -Mexperimental=builtin -wE 'say builtin::is_bool chdir "/invalid*"'
1
$

I.e. a false value should stringify to the empty string and be is_bool.

Alternatively, the documentation should be changed to match the existing behavior.

(This is with v5.40.0.)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4