Skip Menu |

This queue is for tickets about the IO-stringy CPAN distribution.

Report information
The Basics
Id: 2172
Status: resolved
Priority: 0/
Queue: IO-stringy

People
Owner: cwhitener [...] gmail.com
Requestors: planz [...] epost.de
Cc:
AdminCc:

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

Attachments
IO-stringy-output-record-separator-not-respected.patch



Subject: $\ (output record separator) not respected
Hi, I have a problem with IO::Scalar not respecting $\ (which should be appended to any print output automatically). Here is a test script: #!/usr/bin/perl use IO::Scalar; my $a =''; my $out = new IO::Scalar(\$a); $\ = " world\n"; print STDERR 'Hello'; print $out 'Hello'; die 'IO::Scalar does not print $\\: '.$a unless $a eq 'Hello world'; __END__ note that this prints 'Hello world' to STDERR but not via IO::Scalar (which prints just 'Hello') Cheers, Thilo $IO::Stringy::VERSION = 2.108 This is perl, v5.6.0 built for darwin Darwin Macintosh.local. 6.4 Darwin Kernel Version 6.4: Wed Jan 29 18:50:42 PST 2003; root:xnu/xnu-344.26.obj~1/RELEASE _PPC Power Macintosh powerpc
Date: Mon, 3 Mar 2003 12:15:01 UT
To: bug-IO-stringy [...] rt.cpan.org
Subject: Refused: [cpan #2172] $\ (output record separator) not respected
CC: <nobody [...] fsck.com>, "Guest via RT" <bug-IO-stringy [...] rt.cpan.org>
From: eryq [...] zeegee.com
RT-Send-Cc:
Sorry, but my spam filter doesn't recognize you, so your message is being deleted and returned. If you are trying to get in touch with me, please forward this letter back, and give it the special subject line of: white rabbit This will guarantee that I receive your message, and I may choose to add you to my whitelist. Or not.
Download (untitled)
message/rfc822 2.5k
Return-Path: <nobody@fsck.com> Received: from 207.172.4.24 (207.172.4.24 [207.172.4.24]) by ms02.mrf.mail.rcn.net (Mirapoint Messaging Server MOS 3.2.2-GA FastPath) with ESMTP id BAP43777; Mon, 03 Mar 2003 07:02:38 -0500 (EST) Received: from virtual.mrf.mail.rcn.net (virtual.mrf.mail.rcn.net [207.172.4.103]) by mr05.mrf.mail.rcn.net (Mirapoint Messaging Server MOS 3.2.2-GA) with ESMTP id AUW79867; Mon, 3 Mar 2003 07:02:37 -0500 (EST) Received: from one.develooper.com ([64.81.84.115] helo=ran-out.mx.develooper.com) by virtual.mrf.mail.rcn.net with smtp (Exim 3.35 #4) id 18poeS-0007cf-00 for eryq@zeegee.com; Mon, 03 Mar 2003 07:02:36 -0500 Received: (qmail 8679 invoked by uid 225); 3 Mar 2003 12:02:34 -0000 Delivered-To: ERYQ@cpan.org Received: (qmail 8674 invoked by uid 507); 3 Mar 2003 12:02:32 -0000 Received: from postfix@pallas.eruditorum.org (HELO pallas.eruditorum.org) (63.251.136.85) by one.develooper.com (qpsmtpd/0.21-dev) with SMTP; Mon, 03 Mar 2003 04:02:22 -0800 Received: by pallas.eruditorum.org (Postfix, from userid 65534) id 0BE2411171; Mon, 3 Mar 2003 07:02:14 -0500 (EST) Subject: [cpan #2172] $\ (output record separator) not respected From: "Guest via RT" <bug-IO-stringy@rt.cpan.org> Reply-To: bug-IO-stringy@rt.cpan.org In-Reply-To: <rt-2172@cpan> Message-ID: <rt-2172-5746.13.0296836346698@cpan.org> Precedence: bulk X-RT-Loop-Prevention: cpan RT-Ticket: cpan #2172 Managed-by: RT 2.0.15 (http://bestpractical.com/rt/) To: "AdminCc of cpan Ticket #2172": ; Date: Mon, 3 Mar 2003 07:02:14 -0500 (EST) X-SMTPD: qpsmtpd/0.21-dev, http://develooper.com/code/qpsmtpd/ X-Spam-Check-By: one.develooper.com X-Spam-Status: No, hits=2.1 required=7.0 tests=CARRIAGE_RETURNS,IN_REP_TO,SPAM_PHRASE_01_02,TO_HAS_SPACES,TO_MALFORMED version=2.44 This message about IO-stringy was sent to you by guest <> via rt.cpan.org Full context and any attached attachments can be found at: <URL: https://rt.cpan.org/Ticket/Display.html?id=2172 > Hi, I have a problem with IO::Scalar not respecting $\ (which should be appended to any print output automatically). Here is a test script: #!/usr/bin/perl use IO::Scalar; my $a =''; my $out = new IO::Scalar(\$a); $\ = " world\n"; print STDERR 'Hello'; print $out 'Hello'; die 'IO::Scalar does not print $\\: '.$a unless $a eq 'Hello world'; __END__ note that this prints 'Hello world' to STDERR but not via IO::Scalar (which prints just 'Hello') Cheers, Thilo $IO::Stringy::VERSION = 2.108 This is perl, v5.6.0 built for darwin Darwin Macintosh.local. 6.4 Darwin Kernel Version 6.4: Wed Jan 29 18:50:42 PST 2003; root:xnu/xnu-344.26.obj~1/RELEASE _PPC Power Macintosh powerpc
From: julian [...] mehnle.net
The attached patch fixes all proprietary print() methods to append $\ to the print()ed value, and forbids the use of IO::Lines with $\ set to anything but undef or "\n".
diff -ruN IO-stringy-2.109/lib/IO/Lines.pm IO-stringy-2.109-output-record-separator-not-respected/lib/IO/Lines.pm --- IO-stringy-2.109/lib/IO/Lines.pm 2001-08-09 10:04:44.000000000 +0200 +++ IO-stringy-2.109-output-record-separator-not-respected/lib/IO/Lines.pm 2005-02-09 01:28:15.000000000 +0100 @@ -127,6 +127,10 @@ # Print ARGS to the underlying line array. # sub print { + if (defined $\ && $\ ne "\n") { + croak 'unsupported $\: must be "\n" or undef'; + } + my $self = shift; ### print STDERR "\n[[ARRAY WAS...\n", @{*$self->{AR}}, "<<EOF>>\n"; my @lines = split /^/, join('', @_); @lines or return 1; diff -ruN IO-stringy-2.109/lib/IO/ScalarArray.pm IO-stringy-2.109-output-record-separator-not-respected/lib/IO/ScalarArray.pm --- IO-stringy-2.109/lib/IO/ScalarArray.pm 2001-08-09 10:04:44.000000000 +0200 +++ IO-stringy-2.109-output-record-separator-not-respected/lib/IO/ScalarArray.pm 2005-02-09 01:30:25.000000000 +0100 @@ -383,7 +383,7 @@ sub print { my $self = shift; - push @{*$self->{AR}}, join('', @_); ### add the data + push @{*$self->{AR}}, join('', @_) . $\; ### add the data $self->_setpos_to_eof; 1; } diff -ruN IO-stringy-2.109/lib/IO/Scalar.pm IO-stringy-2.109-output-record-separator-not-respected/lib/IO/Scalar.pm --- IO-stringy-2.109/lib/IO/Scalar.pm 2003-12-21 19:51:45.000000000 +0100 +++ IO-stringy-2.109-output-record-separator-not-respected/lib/IO/Scalar.pm 2005-02-09 01:18:12.000000000 +0100 @@ -418,19 +418,19 @@ sub print { my $self = shift; - *$self->{Pos} = length(${*$self->{SR}} .= join('', @_)); + *$self->{Pos} = length(${*$self->{SR}} .= join('', @_) . $\); 1; } sub _unsafe_print { my $self = shift; - my $append = join('', @_); + my $append = join('', @_) . $\; ${*$self->{SR}} .= $append; *$self->{Pos} += length($append); 1; } sub _old_print { my $self = shift; - ${*$self->{SR}} .= join('', @_); + ${*$self->{SR}} .= join('', @_) . $\; *$self->{Pos} = length(${*$self->{SR}}); 1; }
Thanks for reporting this. It was resolved quite some time ago, so I'm closing this ticket now. Thanks, Chase