[29778] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1021 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 10 09:09:43 2007

Date: Sat, 10 Nov 2007 06:09: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           Sat, 10 Nov 2007     Volume: 11 Number: 1021

Today's topics:
    Re: $5 reward for this Perl script (regular expression  <lucavilla@cashette.com>
        File Size Limit in Archive::Perl <anoopsanthosh@gmail.com>
        new CPAN modules on Sat Nov 10 2007 (Randal Schwartz)
    Re: Set TCP_MAXSEG (OS buffering) on Win32?  How? <thepoet_nospam@arcor.de>
    Re: Why can't you slice an array @a[3..-1]? <nospam-abuse@ilyaz.org>
    Re: Why can't you slice an array @a[3..-1]? <nospam-abuse@ilyaz.org>
    Re: Why can't you slice an array @a[3..-1]? <nospam-abuse@ilyaz.org>
    Re: Why can't you slice an array @a[3..-1]? <m@rtij.nl.invlalid>
    Re: Why can't you slice an array @a[3..-1]? <rvtol+news@isolution.nl>
    Re: Why can't you slice an array @a[3..-1]? <bik.mido@tiscalinet.it>
    Re: Why can't you slice an array @a[3..-1]? <bik.mido@tiscalinet.it>
    Re: Why can't you slice an array @a[3..-1]? <bik.mido@tiscalinet.it>
    Re: Why can't you slice an array @a[3..-1]? <bik.mido@tiscalinet.it>
    Re: Why can't you slice an array @a[3..-1]? <bik.mido@tiscalinet.it>
    Re: Why can't you slice an array @a[3..-1]? <bik.mido@tiscalinet.it>
    Re: Why can't you slice an array @a[3..-1]? <abigail@abigail.be>
    Re: zipping large file using Archive::Zip <thepoet_nospam@arcor.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 10 Nov 2007 03:08:52 -0800
From:  Luca Villa <lucavilla@cashette.com>
Subject: Re: $5 reward for this Perl script (regular expression searches through an entire directory of files)
Message-Id: <1194692932.671956.83700@d55g2000hsg.googlegroups.com>


use...@DavidFilmer.com ha scritto:

> On Nov 9, 5:14 pm, Luca Villa <lucavi...@cashette.com> wrote:
> > *** I offer $5 via Paypal for the first working complete Perl script
>
> Make it a $25 contribution to The Perl Foundation (via PayPal to
> billing@yapc.org), and send the submitter a copy of the receipt, and
> you might get more interest.  I might write it.
>
>
> --
> The best way to get a good answer is to ask a good question.
> David Filmer (http://DavidFilmer.com)

David, thanks for the suggestion!
This time I got it answered in another forum for $5 but next time I'll
really add the option to give the money to The Perl Foundation. Very
good idea!
Offer retracted.



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

Date: Sat, 10 Nov 2007 11:34:40 -0000
From:  San <anoopsanthosh@gmail.com>
Subject: File Size Limit in Archive::Perl
Message-Id: <1194694480.993935.212260@z24g2000prh.googlegroups.com>

Hi All,

Is there any way to limit the file size while zipping using
Archive::Zip so that it will stop processing a zip operation on a file
list when it crosses the maximum file size.

Thanks in advance.

-A



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

Date: Sat, 10 Nov 2007 05:42:19 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sat Nov 10 2007
Message-Id: <Jr9zuJ.1rHA@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

AnyEvent-2.6
http://search.cpan.org/~mlehmann/AnyEvent-2.6/
provide framework for multiple event loops 
----
Apache2-AuthenOpenID-0.04
http://search.cpan.org/~danjou/Apache2-AuthenOpenID-0.04/
OpenID authen hander for mod_perl2. 
----
Business-Billing-TMobile-UK-0.14
http://search.cpan.org/~srshah/Business-Billing-TMobile-UK-0.14/
The fantastic new Business::Billing::TMobile::UK! 
----
CGI-Widget-Tabs-1.14
http://search.cpan.org/~srshah/CGI-Widget-Tabs-1.14/
Create tab widgets in HTML 
----
CPAN-Site-0.16
http://search.cpan.org/~markov/CPAN-Site-0.16/
CPAN.pm subclass for adding site local modules 
----
CSS-Squish-0.07
http://search.cpan.org/~ruz/CSS-Squish-0.07/
Compact many CSS files into one big file 
----
Carp-Source-0.01
http://search.cpan.org/~marcel/Carp-Source-0.01/
warn of errors with stack backtrace and source context 
----
Catalyst-Engine-Wx-0.02_03
http://search.cpan.org/~eriam/Catalyst-Engine-Wx-0.02_03/
Catalyst wxPerl Engine 
----
CatalystX-CRUD-0.07
http://search.cpan.org/~karman/CatalystX-CRUD-0.07/
CRUD framework for Catalyst applications 
----
CatalystX-CRUD-0.08
http://search.cpan.org/~karman/CatalystX-CRUD-0.08/
CRUD framework for Catalyst applications 
----
CatalystX-CRUD-Controller-RHTMLO-0.06
http://search.cpan.org/~karman/CatalystX-CRUD-Controller-RHTMLO-0.06/
Rose::HTML::Objects CRUD controller 
----
CatalystX-CRUD-Model-RDBO-0.05
http://search.cpan.org/~karman/CatalystX-CRUD-Model-RDBO-0.05/
Rose::DB::Object CRUD 
----
Chemistry-Elements-1.05
http://search.cpan.org/~bdfoy/Chemistry-Elements-1.05/
Perl extension for working with Chemical Elements 
----
Config-Inetd-0.26
http://search.cpan.org/~schubiger/Config-Inetd-0.26/
Interface inetd's configuration file 
----
ConfigReader-Simple-1.26
http://search.cpan.org/~bdfoy/ConfigReader-Simple-1.26/
Simple configuration file parser 
----
Coro-4.2
http://search.cpan.org/~mlehmann/Coro-4.2/
coroutine process abstraction 
----
Crypt-Rijndael-1.05
http://search.cpan.org/~bdfoy/Crypt-Rijndael-1.05/
Crypt::CBC compliant Rijndael encryption module 
----
Data-Decode-0.00006
http://search.cpan.org/~dmaki/Data-Decode-0.00006/
Pluggable Data Decoder 
----
Data-KeyDiff-0.020
http://search.cpan.org/~rkrimen/Data-KeyDiff-0.020/
Diff one set/list against another with a key basis 
----
Data-KeyDiff-0.021
http://search.cpan.org/~rkrimen/Data-KeyDiff-0.021/
Diff one set/list against another with a key basis 
----
Data-Storage-0.04
http://search.cpan.org/~marcel/Data-Storage-0.04/
generic abstract storage mechanism 
----
DateTime-TimeZone-0.6904
http://search.cpan.org/~drolsky/DateTime-TimeZone-0.6904/
Time zone object base class and factory 
----
DateTimeX-Easy-0.070
http://search.cpan.org/~rkrimen/DateTimeX-Easy-0.070/
Use DT::F::Flexible and DT::F::Natural for quick and easy DateTime creation 
----
DateTimeX-Easy-0.071
http://search.cpan.org/~rkrimen/DateTimeX-Easy-0.071/
Parse a date/time string using the best method available 
----
DateTimeX-Easy-0.075
http://search.cpan.org/~rkrimen/DateTimeX-Easy-0.075/
Parse a date/time string using the best method available 
----
Devel-Declare-0.001005
http://search.cpan.org/~mstrout/Devel-Declare-0.001005/
----
Dist-Joseki-0.06
http://search.cpan.org/~marcel/Dist-Joseki-0.06/
tools for the prolific module author 
----
Dist-Joseki-0.07
http://search.cpan.org/~marcel/Dist-Joseki-0.07/
tools for the prolific module author 
----
EV-0.7
http://search.cpan.org/~mlehmann/EV-0.7/
perl interface to libev, a high performance full-featured event loop 
----
Encode-IBM-0.07
http://search.cpan.org/~audreyt/Encode-IBM-0.07/
IBM-specific encoding mappings 
----
File-Find-Closures-1.07
http://search.cpan.org/~bdfoy/File-Find-Closures-1.07/
functions you can use with File::Find 
----
Formatter-HTML-MPS-0.4
http://search.cpan.org/~vetler/Formatter-HTML-MPS-0.4/
----
Getopt-CallingName-1.13
http://search.cpan.org/~srshah/Getopt-CallingName-1.13/
Script duties delegation based upon calling name 
----
Getopt-CallingName-1.14
http://search.cpan.org/~srshah/Getopt-CallingName-1.14/
Script duties delegation based upon calling name 
----
Gungho-0.09003_03
http://search.cpan.org/~dmaki/Gungho-0.09003_03/
Yet Another High Performance Web Crawler Framework 
----
InSilicoSpectro-1.3.7
http://search.cpan.org/~alexmass/InSilicoSpectro-1.3.7/
Open source Perl library for proteomics 
----
Language-Befunge-Debugger-0.2.1
http://search.cpan.org/~jquelin/Language-Befunge-Debugger-0.2.1/
a graphical debugger for Language::Befunge 
----
Language-Befunge-Debugger-0.2.2
http://search.cpan.org/~jquelin/Language-Befunge-Debugger-0.2.2/
a graphical debugger for Language::Befunge 
----
Language-Befunge-Debugger-0.3.0
http://search.cpan.org/~jquelin/Language-Befunge-Debugger-0.3.0/
a graphical debugger for Language::Befunge 
----
Language-MuldisD-0.10.0
http://search.cpan.org/~duncand/Language-MuldisD-0.10.0/
Formal spec of Muldis D relational DBMS lang 
----
Mail-Box-2.078
http://search.cpan.org/~markov/Mail-Box-2.078/
manage a mailbox, a folder with messages 
----
Module-Changes-0.03
http://search.cpan.org/~marcel/Module-Changes-0.03/
Machine-readable Changes file 
----
Module-Changes-0.04
http://search.cpan.org/~marcel/Module-Changes-0.04/
Machine-readable Changes file 
----
Module-Changes-0.05
http://search.cpan.org/~marcel/Module-Changes-0.05/
Machine-readable Changes file 
----
Module-Starter-1.470
http://search.cpan.org/~rjbs/Module-Starter-1.470/
a simple starter kit for any module 
----
Module-Starter-Plugin-TT2-0.124
http://search.cpan.org/~rjbs/Module-Starter-Plugin-TT2-0.124/
TT2 templates for Module::Starter::Template 
----
Net-Address-Ethernet-1.099
http://search.cpan.org/~mthurn/Net-Address-Ethernet-1.099/
find hardware ethernet address 
----
Net-Digg-0.1
http://search.cpan.org/~kwilms/Net-Digg-0.1/
Quickly consume and interface with the Digg API. 
----
Number-Rangify-0.01
http://search.cpan.org/~marcel/Number-Rangify-0.01/
optimize a list of values into ranges 
----
OODoc-1.02
http://search.cpan.org/~markov/OODoc-1.02/
object oriented production of code related documentation 
----
Object-InsideOut-3.33
http://search.cpan.org/~jdhedden/Object-InsideOut-3.33/
Comprehensive inside-out object support module 
----
POE-Component-CPAN-YACSmoke-1.07
http://search.cpan.org/~bingos/POE-Component-CPAN-YACSmoke-1.07/
Bringing the power of POE to CPAN smoke testing. 
----
POE-Component-Server-FTP-0.08
http://search.cpan.org/~xantus/POE-Component-Server-FTP-0.08/
Event-based FTP server on a virtual filesystem 
----
Parse-Marpa-0.001_038
http://search.cpan.org/~jkegl/Parse-Marpa-0.001_038/
Jay Earley's general parsing algorithm with LR(0) precomputation 
----
Parse-RecDescent-FAQ-6.0.b
http://search.cpan.org/~tbone/Parse-RecDescent-FAQ-6.0.b/
the official, authorized FAQ for Parse::RecDescent. 
----
ProgressMonitor-0.24
http://search.cpan.org/~knth/ProgressMonitor-0.24/
a flexible and configurable framework for providing feedback on how a long-running task is proceeding. 
----
Regexp-Common-AT-NICAT-0.01
http://search.cpan.org/~marcel/Regexp-Common-AT-NICAT-0.01/
Defines patterns for NICAT objects 
----
Rose-DBx-Garden-0.02
http://search.cpan.org/~karman/Rose-DBx-Garden-0.02/
bootstrap Rose::DB::Object and Rose::HTML::Form classes 
----
Rose-DBx-Garden-0.03
http://search.cpan.org/~karman/Rose-DBx-Garden-0.03/
bootstrap Rose::DB::Object and Rose::HTML::Form classes 
----
Rose-DBx-Garden-Catalyst-0.01
http://search.cpan.org/~karman/Rose-DBx-Garden-Catalyst-0.01/
plant Roses in your Catalyst garden 
----
Rose-HTMLx-Form-Field-Boolean-0.01
http://search.cpan.org/~karman/Rose-HTMLx-Form-Field-Boolean-0.01/
extend RHTMLO RadioButtonGroup 
----
Rose-HTMLx-Form-Field-Boolean-0.02
http://search.cpan.org/~karman/Rose-HTMLx-Form-Field-Boolean-0.02/
extend RHTMLO RadioButtonGroup 
----
ShipIt-Step-DistClean-0.01
http://search.cpan.org/~marcel/ShipIt-Step-DistClean-0.01/
ShipIt step for cleaning the distribution 
----
ShipIt-Step-Manifest-0.01
http://search.cpan.org/~marcel/ShipIt-Step-Manifest-0.01/
ShipIt step for recreating the MANIFEST 
----
Sub-CharacterProperties-0.01
http://search.cpan.org/~marcel/Sub-CharacterProperties-0.01/
support for user-defined character properties 
----
Sub-CharacterProperties-0.02
http://search.cpan.org/~marcel/Sub-CharacterProperties-0.02/
support for user-defined character properties 
----
Sub-CharacterProperties-0.03
http://search.cpan.org/~marcel/Sub-CharacterProperties-0.03/
support for user-defined character properties 
----
Template-Plugin-EnvHash-1.05
http://search.cpan.org/~srshah/Template-Plugin-EnvHash-1.05/
Environment Variable Hash for TT2 
----
Template-Plugin-EnvHash-1.06
http://search.cpan.org/~srshah/Template-Plugin-EnvHash-1.06/
Environment Variable Hash for TT2 
----
Test-Distribution-1.28
http://search.cpan.org/~srshah/Test-Distribution-1.28/
perform tests on all modules of a distribution 
----
Test-Distribution-1.29
http://search.cpan.org/~srshah/Test-Distribution-1.29/
perform tests on all modules of a distribution 
----
Tk-Clock-0.21
http://search.cpan.org/~hmbrand/Tk-Clock-0.21/
Clock widget with analog and digital display 
----
Tk-PerlInheritanceTree-0.03
http://search.cpan.org/~lamprecht/Tk-PerlInheritanceTree-0.03/
Display a graphical representation of the inheritance tree for a given class-name. 
----
Tk-PerlMethodList-0.06
http://search.cpan.org/~lamprecht/Tk-PerlMethodList-0.06/
query the Symbol-table for methods (subroutines) defined in a class (package) and its parents. 
----
WWW-Scraper-ISBN-Siciliano_Driver-0.02
http://search.cpan.org/~joenio/WWW-Scraper-ISBN-Siciliano_Driver-0.02/
Search driver for Siciliano's online catalog. 
----
WWW-StreetMap-0.14
http://search.cpan.org/~srshah/WWW-StreetMap-0.14/
Interface to http://www.streetmap.co.uk/ 
----
WWW-StreetMap-0.15
http://search.cpan.org/~srshah/WWW-StreetMap-0.15/
Interface to http://www.streetmap.co.uk/ 
----
X11-GUITest-record-0.13
http://search.cpan.org/~mkoderer/X11-GUITest-record-0.13/
Perl implementation of the X11 record extension. 
----
XML-Bare-0.24
http://search.cpan.org/~codechild/XML-Bare-0.24/
Minimal XML parser implemented via a C state engine 
----
XML-Bare-0.25
http://search.cpan.org/~codechild/XML-Bare-0.25/
Minimal XML parser implemented via a C state engine 
----
XML-Bare-0.26
http://search.cpan.org/~codechild/XML-Bare-0.26/
Minimal XML parser implemented via a C state engine 
----
httpd_ctl-1.04
http://search.cpan.org/~srshah/httpd_ctl-1.04/
An apache httpd control script that supports Template Toolkit pre-processing 
----
httpd_ctl-1.05
http://search.cpan.org/~srshah/httpd_ctl-1.05/
An apache httpd control script that supports Template Toolkit pre-processing 
----
overload-eval-0.07
http://search.cpan.org/~jjore/overload-eval-0.07/
Hooks the native string eval() function 
----
txt2html-2.46
http://search.cpan.org/~rubykat/txt2html-2.46/
convert plain text file to HTML. 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Sat, 10 Nov 2007 09:06:26 +0100
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: Set TCP_MAXSEG (OS buffering) on Win32?  How?
Message-Id: <47356623$0$13119$9b4e6d93@newsspool2.arcor-online.net>

Ed W wrote:
> Bah, bother
> 
> I can't find a bunch of articles now which suggest that TCP_MAXSEG is a 
> roundabout route to accidently controlling the advertised receive 
> window.  However, I am sure I have seen something about this

There has been some confusion over that topic for a long
time, and I bet that a lot of people are glad now that
less misleading information shows up in google nowadays.

> The goal anyway is to control the advertised receive window in the hope 
> that this will indirectly affect the actual transmit window at the 
> remote end (this is all on localhost so it's quite controllable).

That would by no means be a documented and reliable behaviour
and prone to change with different OS patchlevels without
prior warning. Don't go there, it will give you quite a bit of
a headache in the future.

> Some tests here suggest that SO_RCVBUF actually controls the transmit 
> buffer to some extent on Vista, but on XP it's not happening...

As the WinSock reference states, modifying SO_RCVBUF on an
established socket is only allowed on Windows Vista/Longhorn
and above (see the documentation for Winsock IOCTLs, namely
SIO_SET_COMPATIBILITY_MODE). This can work together with
tcp window autotuning, but if you want to distribute your
application to foreign systems, then you have to be aware that
many companies disable autotuning on Vista because it doesn't
work well with other IP stack implementations (especially
some firewall/vpn devices or older unices).

> Any other suggestions?  I don't control the sending app and I need to 
> throttle it back to around <20KB per min and right now the OS buffers 
> are allowing it to send WAAAAY more data than is reasonable...

What are the symptoms of "allowing it to send WAAAAY more data..."?
Does the sending app fail with a winsock error? Does the receiving
part run out of (application) buffer? Do you get lags between
data packets? Each of those would mean that a different approach
is neccessary.

If you're getting a socket error from the downstream app, I'm not
sure if there is a clean way to control that by modfifying the
receive socket.

Would simply receiving all the data asynchronuously and filtering
out some parts of it to be passed on via the slower link not be an
option?

-Chris


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

Date: Sat, 10 Nov 2007 02:34:15 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Why can't you slice an array @a[3..-1]?
Message-Id: <fh35b7$2q6u$1@agate.berkeley.edu>

[A complimentary Cc of this posting was NOT [per weedlist] sent to
Michele Dondi 
<bik.mido@tiscalinet.it>], who wrote in article <lee9j3lrk66k48omq39f9hainn2ndc8sbc@4ax.com>:

> As Perl is now is mostly satisfactory

Could not agree less.  Perl IS nighmarish NOW.

> The big challenge of Perl 6 is to achieve a high degree of dwimmery
> while staying at the same time consistent and orthogonal. It aims, in
> other words, at bringing dwimmery into the basic "vector space
> structure". Well, sort of.

What I saw of Perl6 is much much worse than even Perl5.

Hope this helps,
Ilya


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

Date: Sat, 10 Nov 2007 02:42:35 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Why can't you slice an array @a[3..-1]?
Message-Id: <fh35qr$2qc6$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Ted Zlatanov 
<tzz@lifelogs.com>], who wrote in article <m2wssrnhbv.fsf@lifelogs.com>:

> IZ> As far as I know, there is no DWIM involved.  There are two operators,
> IZ> both fully-and-simply defined; array offset (which is defined for
> IZ> -$#-1..$#), and range.  You REALLY want the result of an operator be
> IZ> dependent on argument of which operator it is?

> Yes, I think I do.  I could be wrong in wanting it, but it feels right.

When I raised this issue on p5-p about a decade ago, (IIRC) at
first I was arguing on your side.  Now, after thinking about it for
quite some time, my position is the opposite.

Make your own conclusions from this...

> It's like a chocolate donut, only much more abstract :)

> IZ> IMO, Perl evolution should go in DECREASING number of DWIM stuff (at
> IZ> least, as a pragma), not increasing it.  (Currently, the probability
> IZ> of an experienced Perl programmer to predict a result of running
> IZ> *simple* Perl code is close to 0 - unless one severely binds oneself
> IZ> via coding style discipline.  Too many un-/half-documented special
> IZ> cases...)
> 
> I agree.  And yet, I'm tempted by chocolate.

This is what pragmas are about.  IIRC, in the end of 90's, I was
advocating something like

   use kiss;

which would prohibit all hard-to-document and all non-orthogonal
constructs (intended for large projects and teamworks).  Nobody was
interested enough, and, IIRC, my pilot implementations were not
accepted.

> IZ> I do it myself often too.  It does not make it a lesser evil.

> No, but it does tell you something about how people think.  Intuition
> often contradicts logic and consistency.

This is not the reason to follow intuition.  Intuition has its place;
one-liners have their place.  Not everything should be written in a
style appropriate for 1-liners.

Hope this helps,
Ilya


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

Date: Sat, 10 Nov 2007 02:48:40 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Why can't you slice an array @a[3..-1]?
Message-Id: <fh3668$2qi0$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Ted Zlatanov 
<tzz@lifelogs.com>], who wrote in article <m21wazow25.fsf@lifelogs.com>:
> On Fri, 09 Nov 2007 21:17:54 +0100 Michele Dondi <bik.mido@tiscalinet.it> wrote: 

> Well, actually I would argue vehemently that the above should return 3,
> 2, 1, 0, -1 in regular context. 

And you would be wrong in this...

> I think Perl, normally a clever language, is not clever on this.
> Ask any child what 3..-1 should generate as a sequence, and they
> won't say "empty list."

IMO, child's opinion should not have very high priority in design of
programming languages.  Remember how late the concept of 0 made it
into the common culture?

Hint: your proposal breaks the fundamental proportion:

   5..7	   ==> 5 6 7
   5..6	   ==> 5 6
   5..5	   ==> 5
   5..4	   ==> ???

> If 3..-1 returned a downward range, it would be trivial to look at the
> array slice offsets, check if the last number is negative, and do the
> right thing for that case.

I see, you want YET ANOTHER "right thing".  How nice of you...  And
what  @a[5,2] should return, in your opinion?

Hope this helps,
Ilya


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

Date: Sat, 10 Nov 2007 10:19:19 +0100
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: Why can't you slice an array @a[3..-1]?
Message-Id: <pan.2007.11.10.09.17.10@rtij.nl.invlalid>

On Sat, 10 Nov 2007 02:48:40 +0000, Ilya Zakharevich wrote:

> [A complimentary Cc of this posting was sent to Ted Zlatanov
> <tzz@lifelogs.com>], who wrote in article <m21wazow25.fsf@lifelogs.com>:
>> On Fri, 09 Nov 2007 21:17:54 +0100 Michele Dondi
>> <bik.mido@tiscalinet.it> wrote:
> 
>> Well, actually I would argue vehemently that the above should return 3,
>> 2, 1, 0, -1 in regular context.
> 
> And you would be wrong in this...
> 
>> I think Perl, normally a clever language, is not clever on this. Ask
>> any child what 3..-1 should generate as a sequence, and they won't say
>> "empty list."
> 
> IMO, child's opinion should not have very high priority in design of
> programming languages.  Remember how late the concept of 0 made it into
> the common culture?
> 
> Hint: your proposal breaks the fundamental proportion:
> 
>    5..7	   ==> 5 6 7
>    5..6	   ==> 5 6
>    5..5	   ==> 5
>    5..4	   ==> ???
> 

Yes, but how about

  for (3 .. 1) {
     ...
  }

It would be very useful to have that count back, and it would be very 
intuitive imo.

M4


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

Date: Sat, 10 Nov 2007 10:24:23 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Why can't you slice an array @a[3..-1]?
Message-Id: <fh4111.90.1@news.isolution.nl>

Ted Zlatanov schreef:

> I don't see why it's not possible, *within the context of an array
> slice*, to override the .. and ... operators to replace negative
> numbers with the corresponding array offsets.

Another DWIM-candidate: 

being able to write

    return \%data{@keys}

in stead of (the copying)

    my %tmp;
    @tmp{@keys} = @data{@keys};
    return \%tmp;
#   ;)



(on p5p, Josh Jore came up with:

    return sub { \@_ }->( @data{@keys} );
)

-- 
Affijn, Ruud

"Gewoon is een tijger."


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

Date: Sat, 10 Nov 2007 11:56:31 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Why can't you slice an array @a[3..-1]?
Message-Id: <sd3bj3di1dmd37l2sukvlj9k2mav5uut5e@4ax.com>

On Fri, 09 Nov 2007 17:02:12 -0600, Clint Olsen
<clint.olsen@gmail.com> wrote:

>> subscripting strongly reminds me of mathematical usage. A range of 3..-1
>> returning 3..$#array reminds me of a mathematical nightmare.
>
>Well, I was thinking more '..' in an array/list context, but yeah.

Well, that would be... quite about anywhere, since C<..> in scalar
context is an entirely different beast. And since you mention *list*
context (there is not *really* anything like "array" context in Perl)
what meaning should e.g.

  print 3..-2;

print from your pov?


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: Sat, 10 Nov 2007 11:59:53 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Why can't you slice an array @a[3..-1]?
Message-Id: <fl3bj3la5k0bb1rh59f15j18g3llqp4hon@4ax.com>

On Fri, 09 Nov 2007 17:09:38 -0600, Ted Zlatanov <tzz@lifelogs.com>
wrote:

>Well, actually I would argue vehemently that the above should return 3,
>2, 1, 0, -1 in regular context.  I think Perl, normally a clever
>language, is not clever on this.  Ask any child what 3..-1 should
>generate as a sequence, and they won't say "empty list."

Well, I may be a strange animal but it is very unintuitive to me.
3..-1 very directly reads in my mind like "the sequence of integers n
such that 3<=n<=-1", which happens to be empty, period.

Perhaps, at least in this little thing I'm not a child anymore!  ;)


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: Sat, 10 Nov 2007 12:08:43 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Why can't you slice an array @a[3..-1]?
Message-Id: <7r3bj352i2rhiihdf1bpnj2nieoop48j2i@4ax.com>

On Sat, 10 Nov 2007 10:19:19 +0100, Martijn Lievaart
<m@rtij.nl.invlalid> wrote:

>Yes, but how about
>
>  for (3 .. 1) {
>     ...
>  }
>
>It would be very useful to have that count back, and it would be very 
>intuitive imo.

No, it wouldn't, reverse() is what one wants. Admittedly, it is
slightly long to write down. Perhaps one issue is that ".." is
symmetric but represents a "directed" thingie. Of course the arrow is
already taken for something else but some kind of arrow would be
better suited for this semantics, better conveying the significance of
"upto" and "downto". Thus

(imagine some actually suitable symbol in between.)

  3 ^ 1;  # empty
  1 ^ 3;  # 1,2,3
  3 v 1;  # 3,2,1
  1 v 3;  # empty

and if one really really wanted, then perhaps

  $n x $m;  # $n < $m ? $n ^ $m : $n v $m


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: Sat, 10 Nov 2007 12:13:02 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Why can't you slice an array @a[3..-1]?
Message-Id: <lb4bj398m0crc13lp4t5r57pa365rkc5ds@4ax.com>

On Sat, 10 Nov 2007 02:34:15 +0000 (UTC), Ilya Zakharevich
<nospam-abuse@ilyaz.org> wrote:

>> The big challenge of Perl 6 is to achieve a high degree of dwimmery
>> while staying at the same time consistent and orthogonal. It aims, in
>> other words, at bringing dwimmery into the basic "vector space
>> structure". Well, sort of.
>
>What I saw of Perl6 is much much worse than even Perl5.

It may be, but in other respects: certainly ad hoc deviations from
orthogonality have been reduced by several orders of magnitude. It is
by all means more consistent and regular. Whether it is better or
worse, more beautiful or uglier, spicy or sweet and so on, are
entirely different matters.


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: Sat, 10 Nov 2007 12:14:48 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Why can't you slice an array @a[3..-1]?
Message-Id: <9k4bj31dnag2aj3qrrdt9gu7ql2lqikfba@4ax.com>

On Sat, 10 Nov 2007 02:42:35 +0000 (UTC), Ilya Zakharevich
<nospam-abuse@ilyaz.org> wrote:

>When I raised this issue on p5-p about a decade ago, (IIRC) at
>first I was arguing on your side.  Now, after thinking about it for
>quite some time, my position is the opposite.

Smart persons are able to change their mind, in fact.


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: Sat, 10 Nov 2007 12:17:37 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Why can't you slice an array @a[3..-1]?
Message-Id: <2o4bj35enujdr75jp21gqp02g0ifbnvlvu@4ax.com>

On Sat, 10 Nov 2007 10:24:23 +0100, "Dr.Ruud"
<rvtol+news@isolution.nl> wrote:

>Another DWIM-candidate: 
>
>being able to write
>
>    return \%data{@keys}

Well, without even mentioning the referencing thing, first one useful
dwimmery would be the ability to slice a hash like that.

  my %sliced=%data{@keys};


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: 10 Nov 2007 12:34:59 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: Why can't you slice an array @a[3..-1]?
Message-Id: <slrnfjb9bj.ve2.abigail@alexandra.abigail.be>

                                               _
Martijn Lievaart (m@rtij.nl.invlalid) wrote on VCLXXXIV September
MCMXCIII in <URL:news:pan.2007.11.10.09.17.10@rtij.nl.invlalid>:
\\  On Sat, 10 Nov 2007 02:48:40 +0000, Ilya Zakharevich wrote:
\\  
\\ > [A complimentary Cc of this posting was sent to Ted Zlatanov
\\ > <tzz@lifelogs.com>], who wrote in article <m21wazow25.fsf@lifelogs.com>:
\\ >> On Fri, 09 Nov 2007 21:17:54 +0100 Michele Dondi
\\ >> <bik.mido@tiscalinet.it> wrote:
\\ > 
\\ >> Well, actually I would argue vehemently that the above should return 3,
\\ >> 2, 1, 0, -1 in regular context.
\\ > 
\\ > And you would be wrong in this...
\\ > 
\\ >> I think Perl, normally a clever language, is not clever on this. Ask
\\ >> any child what 3..-1 should generate as a sequence, and they won't say
\\ >> "empty list."
\\ > 
\\ > IMO, child's opinion should not have very high priority in design of
\\ > programming languages.  Remember how late the concept of 0 made it into
\\ > the common culture?
\\ > 
\\ > Hint: your proposal breaks the fundamental proportion:
\\ > 
\\ >    5..7	   ==> 5 6 7
\\ >    5..6	   ==> 5 6
\\ >    5..5	   ==> 5
\\ >    5..4	   ==> ???
\\ > 
\\  
\\  Yes, but how about
\\  
\\    for (3 .. 1) {
\\       ...
\\    }
\\  
\\  It would be very useful to have that count back, and it would be very 
\\  intuitive imo.


Yeah, it would be sometimes be useful to have it count back. Often
though, it's also very useful to have 3 .. 1 return an empty list.

I don't know which one is more useful. But that doesn't matter; it's
too late to change. Even if there's more benefit that 3 .. 1 'counts
backwards' than 3 .. 1 being an empty list, the disadvantage of 
changing the meaning (and hence having lots of potential code that
breaks; it's not that .. is an uncommon operation) far outweights 
any possible benefit.

Besides, we already have 'reverse' to count backwards. And it's pretty
simple to write a sub that returns an ascending or descending range depending
on the order of the arguments (untested):

    sub range ($$) {
        return         $_ [0] .. $_ [1] if $_ [0] <= $_ [1];
        return reverse $_ [1] .. $_ [0];
    }


    for (range 3, 1) {
        ...
    }


Note however that having .. count backwards if the second argument 
is smaller than the first, does NOT solve the slice issue.

    @array = qw [one two three four five six];
    @array [3 .. $#array];  # 'four', 'five', 'six'; indented value 
                            # of @array [3 .. -1].
    @array [3 .. -1]        # 'four', 'three', 'two', 'one', 'six';
                            # value if .. counts backwards.


Abigail
-- 
perl -le 's[$,][join$,,(split$,,($!=85))[(q[0006143730380126152532042307].
          q[41342211132019313505])=~m[..]g]]e and y[yIbp][HJkP] and print'


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

Date: Sat, 10 Nov 2007 12:59:57 +0100
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: zipping large file using Archive::Zip
Message-Id: <47359d10$0$27122$9b4e6d93@newsspool1.arcor-online.net>

Mark wrote:
> I have a 16 GB file that I zipped using perl's Archive::zip module.
> When I try to unzip this file using WinZip, it shows the "uncompressed
> size" = 4294967295.
> 
> Upon trying to extract this file via WinZip, the winzip program
> deflates the file correctly to 16 GB, but then before it completes and
> yields control to the user,  WinZip does a file size check between
> actual decompressed size and the file information (uncompressed size)
> stored with the Zip, and, since those don't match, it automatically it
> considers the decompressed file as invalid and removes it from the
> disk.
> 
> This root cause of this problem is due to perl's ZLIB module writing
> an incorrect header information on the zip file
> 
> Can someone please tell me why Perl's Archive::zip module writes
> incorrect information in the zip file header ? Are there any settings
> that can override such behaviour?

The only way around I know of is to use a different decompression
tool. Archive::Zip makes use of Compress::Zlib, which in turn
calls the native zlib library. zlib, however, hasn't adopted the
somewhat proprietary deflate64 extension which PKWare introduced
in the pkzip sdk to make size values > 2^32 possible. In the standard
zip format, "compressed size" and "uncompressed size" are only
4 bytes, therefore the value 4294967295.

Unless deflate64 gets incorporated into zlib, I don't see much
chance that Archive::Zip will be able to produce "correct" zips
of this size. So the short solutions would be to either split
up things into separate files, each smaller than 4 GB uncompressed,
or use a different compression (e.g. tar/bzip2) - at least if
dropping WinZip is a no-go.

-Chris


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

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 V11 Issue 1021
***************************************


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