[23764] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5968 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 22 00:05:44 2003

Date: Sun, 21 Dec 2003 21:05:04 -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           Sun, 21 Dec 2003     Volume: 10 Number: 5968

Today's topics:
    Re: A proposal about logical connectives in conjunction <bik.mido@tiscalinet.it>
    Re: Add Files to Zip File (Anno Siegel)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 23 Dec 2003 00:22:52 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: A proposal about logical connectives in conjunction with comma
Message-Id: <lvreuvkjd4956sgah8fipnj69oc3eh0jfb@4ax.com>

On Sun, 21 Dec 2003 08:46:46 -0600, tadmc@augustmail.com (Tad
McClellan) wrote:

>> just want to discuss a feature I would
>> like to see in (future releases of) Perl]
>
>Step 1 should be enumerating some of the "better" ways that it
>can be done with Today's Perl, so that you can then argue the
>value of your Future Perl versus the cost of implementing it and
>the cost of adding yet another off-beat nook-and-cranny for Perl
>programmers to remember.

I would just want to add... D'Oh! Seeing your examples below and Ala
Qumsieh's one I feel ashamed.

As an excuse, I've had a terrible cold all the day and even if when I
posted my article most probably I hadn't a temperature, indeed now I
have. So it seems that I'm not in my best form today...

Memento: think twice before posting when I'll be in these conditions
next time!

>> In a follow-up to another article I included the following snippet of
>> code:
>> 
>>   @ARGV = grep { 
>>       warn "`$_' is not a directory!\n" unless -d;
>>       -d _;
>>   } @ARGV;
>> 
>> OK, I know there are tons of WTDI. 
>
>We should examine them to see if there isn't already one that
>is "good enough"...
[snip]
>You can fix that in Today's Perl by adding 4 characters:
>
>   @ARGV = grep { -d or warn "`$_' is not a directory!\n" and 0 } @ARGV;
>or
>   @ARGV = grep { -d or warn("`$_' is not a directory!\n"), 0 } @ARGV;
>
>They both seem understandable by Today's Programmers, particularly
>that first one.

Indeed! OTOH

On Sun, 21 Dec 2003 16:06:20 GMT, Ala Qumsieh <qumsieh@cim.mcgill.ca>
wrote:

>How about:
>
>   @ARGV = grep { -d or !warn "'$_' is not a directory!\n" } ...;

And this one both is the most understandable one and "most naturally"
requires only one more character. (I wouldn't put a blank in!)

It has the advantage that "!" adjacent to "or", leading to a
straightforward intuitive interpretation of what "or !" does.

[TMC again]

>> So I
>> wonder if there could be "room for" a comma+or/and/||/&& combination
>> so that
>> 
>>   @ARGV = grep { -d , or warn "`$_' is not a directory!\n" };
>> 
>> should be equivalent to the first solution. 
>
>Your solution does it with 1 added character.
>
>Cost:
>   p5p has to get it to parse in all the places where a binop can occur.
>   Perl programmers have yet another strangeosity to hold in their head.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Huh?!? My judgement must be biased, but I would include that amongst
the benefits ;-) I fully agree on the rest of you analysis...

>> For consistency (IMHO) one should allow 'or ,' even if that would just
>> behave like a regular 'or' would.
>
>   Symmetry is overrated. Overrated is symmetry.  --  Larry Wall

I don't believe in authority principle. But if Larry says that,
then... I believe in it! Oh, well, a part of me does!!

And, quite sincerely, if one should really add a new operator and/or
new syntax and semantics, it would be most Perlish to let those
features accomplish either new tasks or old tasks in an easier,
clearer way.

>It fails _my_ cost-benefit analysis...

What can I say more? When I wrote the OP, as Ben Morrow would say,
"The clueometer was reading zero"...

Squeezing hard my brain to see if one could still get something good
out of my proposal (by modifying it in some sensible way)...


Michele
-- 
# This prints: Just another Perl hacker,
seek DATA,15,0 and  print   q... <DATA>;
__END__


------------------------------

Date: 21 Dec 2003 23:21:57 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Add Files to Zip File
Message-Id: <bs59ul$4ck$1@mamenchi.zrz.TU-Berlin.DE>

Mike Flannigan  <mikeflan@earthlink.net> wrote in comp.lang.perl.misc:
> 
> Anno Siegel wrote:

[using Archive::Zip]

> The files I am trying to zip are like this:  3461.
> They have no extension.  So I'm saying pass up any
> files that do have an extension (don't zip them).
> 
> The script below works fine.  Of course it doesn't
> append the files to the existing zip file that already
> contains zipped up files - it overwrites the file.
> Probably all I need to do now is unzip the existing
> file, and then add all the files back into the zip file.

There is no need for that.  Archive::Zip has methods to create
an archive from a disk file, add members, and write the updated
archive to a new file.  I'd recommend that.  If everything has
worked out (see below), you can rename() the new file to the old
name, completing the update.

Note that the numeric file names you are using for member names are
created by the news server.  They are only unique at one time in a
single news group.  Once an article expires, the server is free to
re-use the number.  If the server is allowed to update groups between
runs, sooner or later you are going to write a member to an archive
that already has that member.  I don't know how Archive::Zip handles
that, but it's something to think of.

[code snipped]

Anno


------------------------------

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.  

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 5968
***************************************


home help back first fref pref prev next nref lref last post