New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
should not warn about stripped newlines in 2-arg open #15031
Comments
From @rjbsCreated by @rjbsWe closed #121085, but it ended by noting this problem: use warnings; my $filename = qq{does-not-exist\n}; The above program warns: Unsuccessful open on filename containing newline at program line 5. Two-arg open trims whitespace from the filename, so the filename being Perl Info
|
From @wolfsageOn Fri Nov 06 07:11:34 2015, rjbs wrote:
Shouldn't this warn? use warnings; my $filename = qq{does-not-exist\n}; Also, why does 2-arg-open strip \n and 3-arg-open not? Is this documented somewhere? Shouldn't these behave the same? -- Matthew Horsfall (alh) |
From [Unknown Contact. See original ticket]On Fri Nov 06 07:11:34 2015, rjbs wrote:
Shouldn't this warn? use warnings; my $filename = qq{does-not-exist\n}; Also, why does 2-arg-open strip \n and 3-arg-open not? Is this documented somewhere? Shouldn't these behave the same? -- Matthew Horsfall (alh) |
From @ap* Matthew Horsfall via RT <perlbug-comment@perl.org> [2016-01-16 18:50]:
Yes it absolutely should. So the behaviours must flip – the 2-arg open does warn but ought not
No they should absolutely not. It is documented right in perlfunc: The filename passed to the one- and two-argument forms of open() This very fact was the raison d’être for 3-arg open in the first place. Regards, |
The RT System itself - Status changed from 'new' to 'open' |
From @wolfsageOn Sun, Jan 17, 2016 at 10:59 PM, Aristotle Pagaltzis <pagaltzis@gmx.de> wrote:
Hmm, it seems strange that we no longer want to warn on 2-arg open. If a user does this intentionally: open(my $fh, "<somefile\n"); it will fail and may surprise them that it didn't work.... Regardless, thanks for the explanation. A possible fix is at -- Matthew Horsfall (alh) |
Migrated from rt.perl.org#126579 (status was 'open')
Searchable as RT126579$
The text was updated successfully, but these errors were encountered: