[25323] in Perl-Users-Digest
Perl-Users Digest, Issue: 7568 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 24 11:16:08 2004
Date: Fri, 24 Dec 2004 08:15:29 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 24 Dec 2004 Volume: 10 Number: 7568
Today's topics:
Re: Line continuation in Perl <lawshouse.public@btconnect.com>
Re: Line continuation in Perl <david@pdbuchan.com>
Re: Line continuation in Perl <david@pdbuchan.com>
Re: Line continuation in Perl <tadmc@augustmail.com>
Re: Line continuation in Perl <david@pdbuchan.com>
Re: Line continuation in Perl <david@pdbuchan.com>
Re: Line continuation in Perl <jurgenex@hotmail.com>
Re: Line continuation in Perl <jurgenex@hotmail.com>
Re: Line continuation in Perl <jwkenne@attglobal.net>
Re: Problem with Open Perl IDE <bik.mido@tiscalinet.it>
Re: reformatting linewrapped e-mail messages. <terrylr@blauedonau.com>
Re: Why does this work? <bik.mido@tiscalinet.it>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 24 Dec 2004 12:53:06 +0000
From: Henry Law <lawshouse.public@btconnect.com>
Subject: Re: Line continuation in Perl
Message-Id: <js3os0dqupjt40kjt7u1uomp9t0lleqo83@4ax.com>
On Thu, 23 Dec 2004 23:36:10 -0500, David Buchan <david@pdbuchan.com>
wrote:
>continue on the next line without any special characters. Active Perl
>didn't seem to keen on that. It said something about interpreting it as
>a function.
A gentle piece of advice. "... said something about ..." doesn't help
anyone to help you, in this group or any other, and hasty people can
get quite irritated if you write it! Please copy and paste the code
you ran, and then copy and paste what ActivePerl actually did say .
This produces the expected output, viz the numbers 0 to 4, one per
line:
-------------------------
# Test Activeperl's line endings
use strict;
use warnings;
for (my $i=0;
$i<
5; $i++
) {
print
"$i\n";
}
-------------------------
(perl -v says "... Binary build 808 provided by ActiveState Corp.
http://www.ActiveState.com")
--
Henry Law <>< Manchester, England
------------------------------
Date: Fri, 24 Dec 2004 08:12:00 -0500
From: David Buchan <david@pdbuchan.com>
Subject: Re: Line continuation in Perl
Message-Id: <MPG.1c35dfa9ed0ee0b798969d@news.ca.inter.net>
Hi Jurgen,
> Show us your code (actually a minimal example that demonstrates the problem)
> and I'm sure we can help you figure out where you went wrong.
The code snippet is:
printf (OUTF "%.2f %.2f lineto\n", (($col*93.75)+31.25),(750-($row*
93.75)));
versus
printf (OUTF "%.2f %.2f lineto\n", (($col*93.75)+31.25),
(750-($row*93.75)));
i.e., I start a newline just before the "(750-...")
The message ActivePerl writes is:
"printf (...) interpreted as function at program.pl line 117."
Perhaps this is not an error but rather just an informational message
letting me know that the line was somewhat unusual as compared to the
rest. It just seemed odd that it would give any message at all,
especially if Perl simply ignores whitespace.
Thanks,
Dave
------------------------------
Date: Fri, 24 Dec 2004 08:15:01 -0500
From: David Buchan <david@pdbuchan.com>
Subject: Re: Line continuation in Perl
Message-Id: <MPG.1c35e06433d0ca5298969e@news.ca.inter.net>
Hi Bob,
> ActiveState Perl (I assume that's what you
> mean by "Active Perl") is no different in that regard (or, for
> that matter, almost any other regard).
ActivePerl is the name of ActiveState's release of Perl.
Anyway, see snippet of code in response to Jurgen.
I'm now thinking maybe it's not an error message.
Dave
------------------------------
Date: Fri, 24 Dec 2004 07:43:04 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Line continuation in Perl
Message-Id: <slrncso778.3lh.tadmc@magna.augustmail.com>
David Buchan <david@pdbuchan.com> wrote:
> Hi Jurgen,
>
>> Show us your code (actually a minimal example that demonstrates the problem)
>> and I'm sure we can help you figure out where you went wrong.
>
> The code snippet is:
>
> printf (OUTF "%.2f %.2f lineto\n", (($col*93.75)+31.25),(750-($row*
> 93.75)));
>
> versus
>
> printf (OUTF "%.2f %.2f lineto\n", (($col*93.75)+31.25),
> (750-($row*93.75)));
>
> i.e., I start a newline just before the "(750-...")
>
> The message ActivePerl writes is:
>
> "printf (...) interpreted as function at program.pl line 117."
Are you saying that one of those makes the message and one of
them does not?
If so, then it looks like a bug in perl to me.
They *both* make the same message for me...
> Perhaps this is not an error but rather just an informational message
^^^^^^^
There is no need to guess about messages from perl, just go look
them up in perldiag.pod and *know*.
> letting me know that the line was somewhat unusual as compared to the
> rest.
perldiag says it is a warning message, not an error message.
> It just seemed odd that it would give any message at all,
That seems odd to me too, especially when...
> especially if Perl simply ignores whitespace.
... using "printf(" instead of "printf (" makes the message go away.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 24 Dec 2004 09:00:40 -0500
From: David Buchan <david@pdbuchan.com>
Subject: Re: Line continuation in Perl
Message-Id: <MPG.1c35eb11b1b991d498969f@news.ca.inter.net>
Hi Tad,
Changing from "printf (" to "printf(" got rid of the warning message for
me too. Interesting.
I clearly have lots to learn. Thanks for the perldiag.pod tip. I'm new
to this language and still a bit overwhelmed.
Thanks,
Dave
------------------------------
Date: Fri, 24 Dec 2004 09:06:20 -0500
From: David Buchan <david@pdbuchan.com>
Subject: Re: Line continuation in Perl
Message-Id: <MPG.1c35ec59650f37349896a0@news.ca.inter.net>
Sorry, I forgot to answer your question:
Yes, the first instance works with no warnings:
printf (OUTF "%.2f %.2f lineto\n", (($col*93.75)+31.25),(750-($row*
93.75)));
versus the second, which gives the warning:
printf (OUTF "%.2f %.2f lineto\n", (($col*93.75)+31.25),
(750-($row*93.75)));
i.e., I start a newline just before the "(750-...")
and now the third, which works with no warnings:
printf(OUTF "%.2f %.2f lineto\n", (($col*93.75)+31.25),
(750-($row*93.75)));
The warning message, when I get it, is always:
"printf (...) interpreted as function at program.pl line 117."
Dave
------------------------------
Date: Fri, 24 Dec 2004 14:06:48 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Line continuation in Perl
Message-Id: <YnVyd.10204$_62.9535@trnddc01>
David Buchan wrote:
> Hi Jurgen,
>
>> Show us your code (actually a minimal example that demonstrates the
>> problem) and I'm sure we can help you figure out where you went
>> wrong.
>
> The code snippet is:
>
> printf (OUTF "%.2f %.2f lineto\n", (($col*93.75)+31.25),(750-($row*
> 93.75)));
>
> versus
>
> printf (OUTF "%.2f %.2f lineto\n", (($col*93.75)+31.25),
> (750-($row*93.75)));
>
> i.e., I start a newline just before the "(750-...")
>
> The message ActivePerl writes is:
>
> "printf (...) interpreted as function at program.pl line 117."
Yes, I can reproduce this behaviour.
Just remove the outermost paranthesis, then you won't get that message any
more.
From 'perldoc -f print':
Also be careful not to
follow the print keyword with a left parenthesis [...]
Coming to think of it, get rid of all the paranthesis in that statement.
They are just confusing and none of them is needed.
> Perhaps this is not an error but rather just an informational message
> letting me know that the line was somewhat unusual as compared to the
> rest. It just seemed odd that it would give any message at all,
> especially if Perl simply ignores whitespace.
Now, why perl produces this message only if there is a line break I have no
idea. For all I know there is no logical reason for it but I am sure the
experts can shed some light on it.
jue
------------------------------
Date: Fri, 24 Dec 2004 14:20:08 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Line continuation in Perl
Message-Id: <sAVyd.10205$_62.566@trnddc01>
Tad McClellan wrote:
> David Buchan <david@pdbuchan.com> wrote:
[code samples snipped]
>> The message ActivePerl writes is:
>>
>> "printf (...) interpreted as function at program.pl line 117."
>
>
> Are you saying that one of those makes the message and one of
> them does not?
>
> If so, then it looks like a bug in perl to me.
>
> They *both* make the same message for me...
I can reproduce the exact issue (simplified the code a bit more because the
OPs newsreader injected a line break in the first example which if not
removed caused the same message to appear in both cases):
No message:
printf (OUTF "%.2f %.2f", 31.25, 93.75);
Produces said message:
printf (OUTF "%.2f %.2f", 31.25,
93.75);
perl, v5.6.1, Binary build 630 provided by ActiveState
jue
------------------------------
Date: Fri, 24 Dec 2004 10:55:58 -0500
From: "John W. Kennedy" <jwkenne@attglobal.net>
Subject: Re: Line continuation in Perl
Message-Id: <G4Xyd.13076$Vs2.12785@fe12.lga>
Bob Walton wrote:
> David Buchan wrote:
>
> > In C, you use a backslash and then continue on the next line.
>
> Really??? I think you're thinking of Unix shell code. C is like Perl
> in that a newline is simply another form of whitespace, and a newline
> can be used anywhere where other forms of whitespace is syntactically
> permitted.
Backslash is used to continue a C preprocessor statement. It also used
to be used to continue a string constant, but ANSI C added a better way.
--
John W. Kennedy
"The bright critics assembled in this volume will doubtless show, in
their sophisticated and ingenious new ways, that, just as /Pooh/ is
suffused with humanism, our humanism itself, at this late date, has
become full of /Pooh./"
-- Frederick Crews. "Postmodern Pooh", Preface
------------------------------
Date: Fri, 24 Dec 2004 13:35:26 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Problem with Open Perl IDE
Message-Id: <t9qns0l8o4hs52dr2s7dsm0qkfm7glcn2u@4ax.com>
On 23 Dec 2004 05:39:16 -0800, "cbr" <chris_breemer@nl.compuware.com>
wrote:
>I'm using the Open Perl IDE to play around with Perl.
Unfortunately I can't help you with this: even if I have occasionally
toyed with the idea of trying out some IDE first or later, my generic
answer remains "use a real editor"! Yes, it's an answer with an
attitude, but undoubtedly with a kidding tone, so hopefully you won't
take it as a personal offence. But then if you really want to use and
IDE I've heard good cmts recently about a Java development tool for
which someone has created an extension dedicated to Perl, and AFAIK
it's not listed in 'perldoc -q IDE'. I can't remember its name,
though...
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 24 Dec 2004 07:27:07 -0600
From: "terry l. ridder" <terrylr@blauedonau.com>
Subject: Re: reformatting linewrapped e-mail messages.
Message-Id: <Pine.LNX.4.61.0412240721530.13957@johann.blauedonau.com>
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
---288568286-454272890-1103894827=:13957
Content-Type: TEXT/PLAIN; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: 8BIT
hello;
On Thu, 23 Dec 2004, Tad McClellan wrote:
> Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
>> terry l. ridder wrote:
>>> Gunnar Hjalmarsson wrote:
>>>> terry l. ridder wrote:
>>>>> what is giving me problems are the linewrapped replies. i am
>>>>> searching for a way in perl to reformat the linewrapped replies.
>>>>
>>>> You may want to check out if, and then how, that issue is handled
>>>> by MHonArc.
>
>>>> aldfldksfj söldkf jalskef jölsakdjf öakdf jölsakdj föasldjföaldf
>>> abcdef
>>>
>>> qpwerpqweri åpqwei råpqowei råpoqwie råpoqwieråpoiqweåproiqwåepo
>>
>> is there really any safe way to tell whether the string 'abcdef' belongs
>> to the previos line, or if it's the beginning of the comment on that
>> line?
>
>
> No.
>
>
> The bad wrapping has made the data into hamburger, the OP wants
> to turn it back into steak.
>
> A futile endeavor, I'm afraid it is too late.
>
well actually i have it working. it is interactive but it does work.
the members of the e-mailing list are pleased with the work.
i use the new perl script while editing the archive's mbox files with
vim.
determine the line numbers that need to be demangled than just do:
:53044,.!perl my-format-vim.pl
and that script demangles those lines.
>
>
--
terry l. ridder ><>
---288568286-454272890-1103894827=:13957--
------------------------------
Date: Fri, 24 Dec 2004 13:35:25 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Why does this work?
Message-Id: <n4qns097vkqde49dg642gdks11s0c33b6c@4ax.com>
On Thu, 23 Dec 2004 18:17:07 +0000, Brian McCauley <nobull@mail.com>
wrote:
>$ perl -e"print -shift, 666" foo
>-foo666
>$ perl -e"print -shift => 666" foo
>-shift666
>
>I would consider the behaviour described in this thread to be a
>(non-serious) bug in Perl and I would consider any script reliant on
>this behaviour to be expoiting a bug in Perl and hense itself broken.
It's not clear to me if you still consider it to be a bug also as per
the second example you gave. Because in that case you probably know
that that Tk thoroughly relies on it...
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 7568
***************************************