Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

This queue is for tickets about the File-Slurper CPAN distribution.

Report information
The Basics
Id: 114341
Status: open
Priority: 0/
Queue: File-Slurper

People
Owner: Nobody in particular
Requestors: abe [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



MIME-Version: 1.0
X-Spam-Status: No, score=-3.232 tagged_above=-99.9 required=10 tests=[AWL=-1.331, BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RP_MATCHES_RCVD=-0.001] autolearn=ham
Content-Disposition: inline
X-Spam-Flag: NO
X-Machine: sym2 x86_64
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAAAAAC3mUtaAAAABGdBTUEAALGPC/xhBQAAADh0RVh0U29mdHdhcmUAWFYgVmVyc2lvbiAzLjEwYSAgUmV2OiAxMi8yOS85NCAoUE5HIHBhdGNoIDEuMindFS5JAAACGElEQVQ4jXXQMU8UYRDG8f8shNjdDH4AbpfGDjAWlKiJiZ0ajL1aGCvsNCbGaCGG1koLaztaTYz6ATy+gOyehYmF3MxVxgg3FnDsHcTpJr/M+8w7Rf6nCsaVTTDqxbg9hoOXmw83H71+Eyfg4E1d7/Z2fG9rGkZbTQiu+K+3U/C+76lmkvAhJuDndnoAiftou4V84okAGclop4U/jYACZDTxrYWP0gkxVfAm/W//GLZpxIzwIN0Hn8dw0B+IWkZmQmRsj2HfhwokEklHfNCCiQCRgAR7YyhQVRVTCKCzP4Y5zBBE0t0zY3Q8oQaBqqAMlVEcgVQd9706zGirAFium8HXumlMIeMwqQCInju+2+uB6MRENupdpMt8pRlHZyuAW0F+Mb6XSIVqtxjD+iVmVqqystLEzFTGT92YqRaXpNT5eTVjeJhbALPnrTxLUZUKZsgxcNm64hAOYisT/xhF+oKTGU5RegtC3Rt6eEDi/QnIevdTx9Md2EMmYBRmCQR1026FCGQQJJExsRUqgkMGaWSbwYLnoO4T6VgpbQbdELPMBAHWWrhYrcxXnYgAsatPWygkFCBD4K62MAsOTqA6szYRPpsu6e6Y8mPiVrBMNuGIMrgwBUu4p2DgG1Ownu6hpuTv7hScefHAzAC/yRRw5U5pALMbJ4AUALvHSZhxgHPXTsHcdWD1GadAHr9avP+c0wCr7263Df8ASLwXWHWs+KIAAAAHdElNRQfYBQEBODPr
X-Operating-System: Linux 3.2.0-4-amd64
content-type: text/plain; charset="utf-8"
Message-ID: <20160512005738.GX5029 [...] sym.noone.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Organization: DeuxChevaux.org -- The Citroën 2CV Database
X-Spam-Score: -3.232
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 097502403B0 for <cpan-bug+File-Slurper [...] hipster.bestpractical.com>; Wed, 11 May 2016 20:57:54 -0400 (EDT)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n9-rFjSUs5Cf for <cpan-bug+File-Slurper [...] hipster.bestpractical.com>; Wed, 11 May 2016 20:57:52 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 2743B240028 for <bug-File-Slurper [...] rt.cpan.org>; Wed, 11 May 2016 20:57:51 -0400 (EDT)
Received: (qmail 1755 invoked by alias); 12 May 2016 00:57:51 -0000
Received: from sym2.noone.org (HELO sym2.noone.org) (178.63.92.236) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Wed, 11 May 2016 17:57:48 -0700
Received: by sym2.noone.org (Postfix, from userid 1000) id 3r4vjJ1cMDzQWbt; Thu, 12 May 2016 02:57:39 +0200 (CEST)
X-Editor: GNU Emacs 23.4.1
Delivered-To: cpan-bug+File-Slurper [...] hipster.bestpractical.com
User-Agent: Mutt/1.5.21 (2010-09-15)
Subject: Please document return values of write_* functions
Return-Path: <abe [...] sym2.noone.org>
X-RT-Mail-Extension: file-slurper
X-Original-To: cpan-bug+File-Slurper [...] hipster.bestpractical.com
X-Spam-Check-BY: la.mx.develooper.com
Date: Thu, 12 May 2016 02:57:39 +0200
X-Spam-Level:
To: bug-File-Slurper [...] rt.cpan.org
From: Axel Beckert <abe [...] cpan.org>
X-RT-Original-Encoding: ascii
X-RT-Interface: Email
Content-Length: 1132
Download (untitled) / with headers
text/plain 1.1k
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)
MIME-Version: 1.0
In-Reply-To: <20160512005738.GX5029 [...] sym.noone.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <20160512005738.GX5029 [...] sym.noone.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-29616-1463342014-749.114341-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 1137
Download (untitled) / with headers
text/plain 1.1k
On 2016-05-11 20:57:55, abe@cpan.org wrote: Show quoted text
> 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.) >
Reading the source it seems that File::Slurper is using exceptions. So you have to write: ok eval { write_text($file, $string); 1 }, "$file successfully written"; Of course, the fact that exceptions are used should be documented...
MIME-Version: 1.0
X-Spam-Status: No, score=-5.944 tagged_above=-99.9 required=10 tests=[AWL=0.654, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, FROM_OUR_RT=-4, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham
In-Reply-To: <rt-4.0.18-29616-1463342014-435.114341-5-0 [...] rt.cpan.org>
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-114341 [...] rt.cpan.org> <20160512005738.GX5029 [...] sym.noone.org> <rt-4.0.18-29616-1463342014-435.114341-5-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Received: by 10.176.4.198 with SMTP id 64mr11744593uaw.154.1463351367675; Sun, 15 May 2016 15:29:27 -0700 (PDT)
Message-ID: <CAHhgV8i8HReXgVbF5VQvVh=w02efoxM5jUfS2DscAFXVLcZ0bg [...] mail.gmail.com>
Content-Type: multipart/alternative; boundary="94eb2c124e6a73b4100532e90a25"
X-Spam-Score: -5.944
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id B88F0240114 for <cpan-bug+File-Slurper [...] hipster.bestpractical.com>; Sun, 15 May 2016 18:29:36 -0400 (EDT)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wZ50fHe+1ohh for <cpan-bug+File-Slurper [...] hipster.bestpractical.com>; Sun, 15 May 2016 18:29:35 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 05259240038 for <bug-File-Slurper [...] rt.cpan.org>; Sun, 15 May 2016 18:29:34 -0400 (EDT)
Received: (qmail 31123 invoked by alias); 15 May 2016 22:29:34 -0000
Received: from mail-vk0-f50.google.com (HELO mail-vk0-f50.google.com) (209.85.213.50) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Sun, 15 May 2016 15:29:31 -0700
Received: by mail-vk0-f50.google.com with SMTP id z184so40420883vkg.0 for <bug-File-Slurper [...] rt.cpan.org>; Sun, 15 May 2016 15:29:31 -0700 (PDT)
Received: by 10.103.125.150 with HTTP; Sun, 15 May 2016 15:29:08 -0700 (PDT)
Delivered-To: cpan-bug+File-Slurper [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #114341] Please document return values of write_* functions
Return-Path: <fawaka [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=Rpsz0b36Qv6ay2Q4rES5giiTjZHF3mtsOmuI72Q2kAk=; b=iSLymzaq0KzSqUbR4+mD1PbjepAvTAGr4L94L8FDcjWcjx5ziKvQ/WHEic87wokkDM HlL7ZsRE/BfSp7UL2Lu3Mp59tQmQkdABHpcVmRP3MW8pt5BvkOBU2ySx8z8UNVVCdsJV aEPvHogdaM8FubZDGk5mA0LyyNh+7HMHPOZ8R+StngpcAjnnEv72hiJ/x43MyqK3H3O2 V5xiMO22lYhsw8m/ArbWyqWcmPCpp5Lyvdk1PIUnLsBbqThyDFgJ1ODrKNfxHIBIzJ20 iQ5NOfcrJFSqSRzK1/L/Zr0qQmTVYBJU5O6Q4CaXA9/9McKV91tIXlwm6FNjER+KjyAs PgDw==
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: cpan-bug+File-Slurper [...] hipster.bestpractical.com
X-RT-Mail-Extension: file-slurper
X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=Rpsz0b36Qv6ay2Q4rES5giiTjZHF3mtsOmuI72Q2kAk=; b=FarRNfku/InHz7lMGy0OJnzf2yejiG+ez6KQeAC7QbxVqhyAnwDj5F0KlUxFbdSoyb juE8BBsiEaxph57MzijhOCRXG/ClDpAuYox1Aom8TY7C5bZwcHvSDeC+hi+WUvhiMju2 CMAc3S8ng8WP+Rl0TWuWilAJCQq5Ki41m2isRO0IzbzT+jDA6JC5djD9B1+pnVpvL6Gg S5drmL+Zb89OK9GK+6fdi9ue58B6PCtzrk6FlW3ZqNb/my1ad85f2d8de+bznGzb4/bL d3ya0cQuG/ZCCdA1JXrUVexnb9bQjDH2MnBgKcKX77s8YRdRP84nSSbe2921SpYOhmmq Tl4g==
X-Google-Sender-Auth: QfgS1rq7iJs8YCEnB7r0O-jqn2w
Sender: fawaka [...] gmail.com
Date: Mon, 16 May 2016 00:29:08 +0200
X-Spam-Level:
To: bug-File-Slurper [...] rt.cpan.org
X-GM-Message-State: AOPr4FUEQtta72nNSH5dVNWZ0U/Ma8Fo0OPq5DYfzIFbQq1hC4JpKNiB2q/YBKmlDSe8hnh2tfPPVMnrWTdGtw==
From: Leon Timmermans <leont [...] cpan.org>
RT-Message-ID: <rt-4.0.18-25968-1463351377-1634.114341-0-0 [...] rt.cpan.org>
Content-Length: 0
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Content-Length: 360
Download (untitled) / with headers
text/plain 360b
On Sun, May 15, 2016 at 9:53 PM, Slaven_Rezic via RT < bug-File-Slurper@rt.cpan.org> wrote: Show quoted text
> Reading the source it seems that File::Slurper is using exceptions. So you > have to write: > > ok eval { write_text($file, $string); 1 }, "$file successfully > written"; > > Of course, the fact that exceptions are used should be documented... >
Agreed. Leon
content-type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 741


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.