Subject: | Please document return values of write_* functions |
Date: | Thu, 12 May 2016 02:57:39 +0200 |
To: | bug-File-Slurper [...] rt.cpan.org |
From: | Axel Beckert <abe [...] cpan.org> |
Hi,
The POD does not mention the return values of the write_* functions.
As it seems they _always_ return false (undef or empty array). Even if
that's on purpose or by design, it should be mentioned in the POD.
Nevertheless, I think File::Slurper should adopt the return values
used by File::Slurp:
By default "write_file" returns 1 upon successfully writing the file
or undef if it encountered an error.
Example: I have tons of Test::More tests which look like this:
ok(write_file($file, $string), "$file successfully written");
With File::Slurper, they look much uglier:
write_file($file, $string);
ok(-f $file, "$file successfully written");
(Sometimes I use -f, sometimes -s. But I consider both to be more
fragile than File::Slurp::write_file's return value for this purpose.)
Kind regards, Axel
--
/~\ Plain Text Ribbon Campaign | Axel Beckert
\ / Say No to HTML in E-Mail and News | abe@deuxchevaux.org (Mail)
X See http://www.nonhtmlmail.org/campaign.html | abe@noone.org (Mail+Jabber)
/ \ I love long mails: http://email.is-not-s.ms/ | http://abe.noone.org/ (Web)