[21763] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3967 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 14 11:11:12 2002

Date: Mon, 14 Oct 2002 08:10:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 14 Oct 2002     Volume: 10 Number: 3967

Today's topics:
        Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
    Re: Switching from Python to Perl <derek@wedgetail.com>
        XWhois parsing denic-format => RegEx <ah@datapharm.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 14 Oct 2002 13:14:03 -0000
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <uqlgormfo0na0f@corp.supernews.com>

Following is a summary of articles spanning a 7 day period,
beginning at 07 Oct 2002 13:57:28 GMT and ending at
14 Oct 2002 12:29:40 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" email address and name.
    - Original Content Rating (OCR) is the ratio of the original content
      volume to the total body volume.
    - Find the News-Scan distribution on the CPAN!
      <URL:http://www.perl.com/CPAN/modules/by-module/News/>
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
    - Copyright (c) 2002 Greg Bacon.
      Verbatim copying and redistribution is permitted without royalty;
      alteration is not permitted.  Redistribution and/or use for any
      commercial purpose is prohibited.

Excluded Posters
================

perlfaq-suggestions\@(?:.*\.)?perl\.com
faq\@(?:.*\.)?denver\.pm\.org
comdog\@panix\.com

Totals
======

Posters:  263
Articles: 797 (324 with cutlined signatures)
Threads:  206
Volume generated: 1608.6 kb
    - headers:    675.1 kb (13,048 lines)
    - bodies:     892.5 kb (29,348 lines)
    - original:   521.0 kb (18,838 lines)
    - signatures: 40.2 kb (1,027 lines)

Original Content Rating: 0.584

Averages
========

Posts per poster: 3.0
    median: 2 posts
    mode:   1 post - 131 posters
    s:      5.2 posts
Posts per thread: 3.9
    median: 3.0 posts
    mode:   1 post - 48 threads
    s:      3.4 posts
Message size: 2066.7 bytes
    - header:     867.4 bytes (16.4 lines)
    - body:       1146.7 bytes (36.8 lines)
    - original:   669.4 bytes (23.6 lines)
    - signature:  51.7 bytes (1.3 lines)

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

   56   152.2 ( 46.7/ 99.4/ 52.3)  Benjamin Goldberg <goldbb2@earthlink.net>
   33    78.5 ( 36.6/ 37.4/ 28.6)  tadmc@augustmail.com
   25    56.0 ( 19.7/ 36.2/ 11.2)  "Domizio Demichelis" <dd@4pro.net>
   20    47.1 ( 22.2/ 24.1/ 17.9)  "Alan J. Flavell" <flavell@mail.cern.ch>
   18    28.8 ( 14.3/ 13.9/  4.4)  "John W. Krahn" <krahnj@acm.org>
   16    30.9 ( 13.4/ 16.3/  8.5)  Brian McCauley <nobull@mail.com>
   14    24.4 ( 10.3/ 11.0/  5.5)  helgi@decode.is
   14    40.5 ( 13.2/ 27.3/ 14.7)  Ilya Zakharevich <nospam-abuse@ilyaz.org>
   13    20.7 (  8.7/ 11.9/  7.4)  Da Witch <heather710101@yahoo.com>
   13    27.6 ( 13.4/ 14.2/ 10.8)  "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>

These posters accounted for 27.9% of all articles.

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

 152.2 ( 46.7/ 99.4/ 52.3)     56  Benjamin Goldberg <goldbb2@earthlink.net>
  78.5 ( 36.6/ 37.4/ 28.6)     33  tadmc@augustmail.com
  56.0 ( 19.7/ 36.2/ 11.2)     25  "Domizio Demichelis" <dd@4pro.net>
  47.1 ( 22.2/ 24.1/ 17.9)     20  "Alan J. Flavell" <flavell@mail.cern.ch>
  41.4 (  6.2/ 35.2/ 11.2)      6  "Jan Klaverstijn" <jan@klaverstijn.nl>
  40.5 ( 13.2/ 27.3/ 14.7)     14  Ilya Zakharevich <nospam-abuse@ilyaz.org>
  30.9 ( 13.4/ 16.3/  8.5)     16  Brian McCauley <nobull@mail.com>
  28.8 ( 14.3/ 13.9/  4.4)     18  "John W. Krahn" <krahnj@acm.org>
  27.8 ( 11.9/ 13.1/  6.1)     12  Uri Guttman <uri@stemsystems.com>
  27.6 ( 13.4/ 14.2/ 10.8)     13  "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>

These posters accounted for 33.0% of the total volume.

Top 10 Posters by OCR (minimum of five posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.996  (  9.2 /  9.3)      9  Jay Tilton <tiltonj@erols.com>
0.764  ( 28.6 / 37.4)     33  tadmc@augustmail.com
0.764  ( 10.8 / 14.2)     13  "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
0.742  ( 17.9 / 24.1)     20  "Alan J. Flavell" <flavell@mail.cern.ch>
0.740  (  5.2 /  7.1)      8  Jeff 'japhy' Pinyan <pinyaj@rpi.edu>
0.740  (  9.3 / 12.6)     11  pkent <pkent77tea@yahoo.com.tea>
0.664  (  6.5 /  9.8)     11  Jeff Zucker <jeff@vpservices.com>
0.640  ( 12.9 / 20.2)      7  Rocco Caputo <troc@netrus.net>
0.626  (  4.9 /  7.9)     12  chris-usenet@roaima.freeserve.co.uk
0.624  (  7.4 / 11.9)     13  Da Witch <heather710101@yahoo.com>

Bottom 10 Posters by OCR (minimum of five posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.392  (  3.0 /  7.6)     11  "Jürgen Exner" <jurgenex@hotmail.com>
0.375  (  3.2 /  8.6)      5  jozefn <jozefn@newbolt.sonic.net>
0.373  (  1.7 /  4.5)      7  Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
0.349  (  2.3 /  6.6)      7  some guy <yoman@dude.com>
0.337  (  1.3 /  3.8)      5  "James E Keenan" <jkeen@concentric.net>
0.318  ( 11.2 / 35.2)      6  "Jan Klaverstijn" <jan@klaverstijn.nl>
0.314  (  4.4 / 13.9)     18  "John W. Krahn" <krahnj@acm.org>
0.308  ( 11.2 / 36.2)     25  "Domizio Demichelis" <dd@4pro.net>
0.295  (  1.9 /  6.3)      6  ctcgag@hotmail.com
0.186  (  1.9 / 10.4)      7  jpagnew@vcu.edu

35 posters (13%) had at least five posts.

Top 10 Threads by Number of Posts
=================================

Posts  Subject
-----  -------

   21  Multiple Pings/Second
   18  Anyone who uses Perl on VAX
   18  ithreads, perl 5.8 and shared objects
   16  Run perl script on web server from command line
   14  Any way around using the $& variable?
   14  Perl script works half the time
   13  Problem with require() versus in-line code
   11  96-column punched-card data
   11  Why is 'defined @x' deprecated?
   11  newb here learning Perl

These threads accounted for 18.4% of all articles.

Top 10 Threads by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Subject
--------------------------  -----  -------

  86.1 ( 18.5/ 66.6/ 30.7)     21  Multiple Pings/Second
  73.4 ( 12.4/ 61.0/ 15.7)     13  Problem with require() versus in-line code
  62.3 ( 17.1/ 43.9/ 21.2)     18  ithreads, perl 5.8 and shared objects
  42.9 ( 17.2/ 25.4/ 10.5)     18  Anyone who uses Perl on VAX
  27.8 ( 14.8/ 12.1/  6.3)     16  Run perl script on web server from command line
  27.0 ( 11.3/ 14.3/  6.4)     14  Perl script works half the time
  24.4 ( 12.9/  9.1/  4.9)     14  Any way around using the $& variable?
  23.3 (  4.5/ 18.7/ 10.9)      5  Extensible event loop architecture
  22.7 (  9.3/ 12.3/  6.7)     11  Why is 'defined @x' deprecated?
  22.6 (  3.7/ 18.7/ 18.2)      4  Posting Guidelines for comp.lang.perl.misc ($Revision: 1.2 $)

These threads accounted for 25.6% of the total volume.

Top 10 Threads by OCR (minimum of five posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Subject
-----  --------------  -----  -------

0.888  (  7.5/   8.4)      6  Is there a way
0.824  (  4.2/   5.1)      6  Re-entrant parser
0.787  (  3.8/   4.8)      5  pod and perldoc on own local modules ?
0.782  (  4.2/   5.4)      6  cgi.pm code
0.770  (  2.8/   3.6)      5  String manipulation help needed
0.768  (  2.2/   2.9)      5  Hello World doesn't work in 5.8??
0.734  (  0.9/   1.2)      5  On Windows:  ioctl.ph
0.726  (  7.4/  10.2)      6  Help! How do you move one html page to another in Perl?
0.719  (  6.7/   9.3)      9  Returning hashrefs
0.707  (  2.3/   3.2)      6  undef == true?

Bottom 10 Threads by OCR (minimum of five posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Subject
-----  --------------  -----  -------

0.457  (  3.1 /  6.7)      5  Help parsing HTML
0.448  (  4.6 / 10.2)      9  Not so simple RE problem...
0.447  (  2.0 /  4.4)      7  join lines in @array
0.443  (  6.4 / 14.3)     14  Perl script works half the time
0.436  (  1.5 /  3.4)      5  pattern matching
0.420  (  1.9 /  4.6)      5  Simple Way to Refer to ARGV Values as a String
0.413  ( 10.5 / 25.4)     18  Anyone who uses Perl on VAX
0.395  (  2.3 /  5.8)      7  flock related issue
0.370  (  2.5 /  6.7)      5  Problems using Http::Date
0.258  ( 15.7 / 61.0)     13  Problem with require() versus in-line code

63 threads (30%) had at least five posts.

Top 10 Targets for Crossposts
=============================

Articles  Newsgroup
--------  ---------

       5  comp.lang.perl.modules
       5  alt.perl
       3  de.comp.lang.perl.misc
       3  comp.lang.perl
       3  comp.unix.shell
       2  comp.lang.perl.moderated
       2  alt.comp.perlcgi.freelance
       1  alt.disasters.misc
       1  comp.answers
       1  comp.programming

Top 10 Crossposters
===================

Articles  Address
--------  -------

       6  "E.D.G." <edgrsprj@ix.netcom.com>
       4  alex@usenix.org
       2  kit <manutd_kit@yahoo.com>
       2  "epanagio" <epanagio@frontiernet.net>
       2  Tony Curtis <tony_curtis32@yahoo.com>
       2  "Tan Nguyen" <nospam@nospam.com>
       2  "Sojourneer" <david.hawley@acm.org>
       2  jari.aalto@poboxes.com
       2  Benjamin Goldberg <goldbb2@earthlink.net>
       1  "Clyde Ingram" <cingram@pjocsNOSPAMORHAM.demon.co.uk>


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

Date: Mon, 14 Oct 2002 23:31:24 +1000
From: Derek Thomson <derek@wedgetail.com>
Subject: Re: Switching from Python to Perl
Message-Id: <3daac76f$0$23174$afc38c87@news.optusnet.com.au>

Eric J. Roode wrote:
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
> 
> Derek Thomson <derek@wedgetail.com> wrote in news:3da91047$0$23169$afc38c87
> @news.optusnet.com.au:
> 
> 
>>Why do you ask? Why does it have to be mutually exclusive? Can't you 
>>like and use both? I am also using, right now, in some capacity, C, 
>>Java, Tcl, Lisp (my Emacs functions!) and I've done a fair bit of C++ in 
>>the past.
> 
> 
> I agree.  I use (mostly) Perl, C, and various webbish languages (html, 
> javascript, etc); it's pretty obvious which language is appropriate when.
> 
> [dons flameproof suit]
> 
> I confess my ignorance of python.  Every now and then I think "maybe I 
> should learn it"... but then I think "Perl does everything I can imagine 
> doing, why bother learning python?"
> 
> [for the record, I often think "Maybe I should learn java", then I start to 
> do so, then I realize "Man! This is hard! Perl does all of this so much 
> easier!"]
> 
> So anyhow, for someone who's ignorant of python, what's it good at?  The 
> same sorts of things as Perl?  If so, why bother learning it?  If not, what 
> are its strengths over Perl, and what are Perl's strengths over python?

Under the syntactic hood, I believe they are more similar than they are 
different - relative to most other popular languages.

They are both dynamic (ie you can create code (including new classes) at 
run-time, and you can explore any data structure, dynamically), and both 
have what I'm going to call an "open" object model - by that I mean that 
it is simple, dynamic (of course), and is OO at run-time ie. no 
information about objects or classes is thrown away during compilation 
(C++ is not really OO at all at run-time, and Java only allows 
reflection into the class information the VM has - but no modification).

Python has a large number of features you will recognize from Perl - 
like lists (analogous to arrays in Perl), hashes, operations for 
selecting and transforming lists, and a lot of the idioms transfer 
pretty cleanly between them.

Now, the differences. As I see them. Python's syntax (and therefore much 
of it's semantics) are minimalist. There fewer syntactic elements, and 
fewer ways to put them together in interesting ways. This has the 
advantage that it's easier to learn and for anyone to read (if the Perl 
code isn't well commented).

For example, Python doesn't allow hash slicing, so you can't do this:

my %hash = {};
@hash{@list} = (1) x @list;

 ... to create a set for fast membership testing. So all those neat 
little idioms Perl has for hash transformation are out. In Python list 
slices must be contiguous, so you can't do nifty one-line list 
shuffling, either. Pythoners will say all this is a feature. In Python, 
you would say something like:

hash = {}
for item in list:
   hash[item] = 1

 ... to do the same thing. Again, clearer for the non-initiated. Some say 
that where Perl has "more than one way to do things", Python has "only 
one way to do one thing". That is of course, not true, but that's the idea.

Notice also that there are no "funny" character "$@%" in front of 
variables in Python, and it doesn't have different kinds of braces for 
different kinds of indexing. Everything in Python is a reference, so you 
don't have this typing problem. Therefore you can't get the contexts 
wrong. On the other hand, this means that there is no context, so the 
compiler can't work out what you're trying to do.

So, for something like:

$hash->{$name}->[$index] = 42

 ... if there was no reference to an array in the hash at $name, one 
would be created. In Python, you have to check, and create one, if 
you're not sure, like in Java or C++. (And then you have to make sure 
the list is large enough for the index, as well). Assuming the lists are 
always MAX_INDEX in length then, to keep it simple:

if name not in hash:
   hash[name] = [0] x MAX_INDEX

hash[name][index] = 42

 ... or something along those lines.

This doesn't really come up too often, but when it does, I certainly 
miss it! Again, the Pythoner will say that this sort of thing is best 
made explicit.

Now, the big one: the object model. Python has exactly one object model. 
Perl supplies only the bare bones support for objects, and you can layer 
a number of alternatives on that, if you like (for example, the fields 
module, or the very interesting Class::Contract module).

The advantage to this is that all classes are guaranteed to work 
together properly, even in the face of inheritance. Will a "standard" 
Perl class be able to inherit a Class::Contract class? I doubt it. I can 
barely get standard Perl classes to inherit from each other nicely 
without clashing :) So, the object model is nice and clean and simple, 
but doesn't allow much in the way of interesting innovation. I think 
Class::Contract would be straight out impossible in Python.

So, some would claim that all this simplicity and standardization make 
Python more amenable to larger projects. I don't know that this is 
necessarily true, as I am working on both Python and Perl 
multi-programmer projects at the moment, and I don't think in either 
case the language itself has been an issue. Of course we use warnings 
and strict in Perl, so this make Perl much safer from the silly errors 
that might give it a poor reputation in terms of maintainability. 
(Python, in short, always warns and is always strict). I admit these are 
still quite small projects (a few developers each), but it does show 
that we *can* read each others code. Perhaps this argument for Python 
holds better for larger projects, and where you can't guarantee that 
every programmer will have learned all the ins-and-outs of a complex and 
subtle language like Perl. I don't know, I'd welcome any further 
discussion on this topic of applying both Perl and Python to really 
large projects.

Then there's the support. Perl's is better, no doubt about it. More 
developers, and a much larger base of *supported* third party modules on 
CPAN. Much of the important stuff in terms of extra modules is there for 
  Python, I just find it isn't always supported as well as I'd like. YMMV.

So, what was the question again? ;)

Ah yes, why learn Python if you know Perl? Because you'll be exposed to 
new ways of doing things, which will actually shed new light on your 
Perl programming. I don't think I'd have come as far with OO Perl if not 
for Python's example of a "one true way" scripting object model (and of 
course Conway's excellent OO Perl book). This cuts both ways - Pythoners 
could learn a thing or two from Perl - I've often found a class in 
Python I *never* would have if I hadn't been thinking "there *must* be a 
way to do this as easily as in Perl" and didn't give up until I found 
it. Sometimes I find things that even more experienced Pythoners didn't 
know about, following this procedure.

Also, it may be worth trying if your team is traditionally scripting 
language resistant (it's much gentler and familiar seeming), or if your 
project is larger and you're convinced that Python is better for that, 
or if you want to integrate with Java.

So, Java. Perl really can't win here, as Python has the amazing Jython. 
Which is Python implemented in Java, basically. Your Python object 
methods can be called from Java code. Your Java classes can call Python 
object methods. Seamlessly. Out of the box. Apart from a few 
differences, Python implemented in C is the same as Python implemented 
in Java. So, you can implement a Swing GUI in Python. Write tests for 
your Java classes in Python. Stub out classes in Python to be 
implemented "properly" later. Even just write the performance critical 
classes in Java, and do the rest (traditionally the layer you want to be 
highly flexible) in Python. Perl can't compete here, unless someone 
implements Perl itself in Java. Given the complexity of Perl, that's 
probably not going to happen. So in this case Python's simplicity is a 
clear win - as it allow implementation on new platforms to spring up 
more easily.

I ported Fnorb (the Python ORB) to Jython with almost no effort - once I 
had removed the little bit of C code in Fnorb. I am seriously impressed 
with it.

A final note. Python is also *much* easier to integrate with C, as well. 
The C API is just much cleaner than Perl XS, which is very complex. And 
it also fits very well with objects in C++, and Perl XS definitely can't 
do this very well. So if my task were basically just to provide a 
scripting interface to some C or C++ code, I'd probably go for Python. I 
wrote a framework to explore the differences between XA implementations 
in various databases in Python in about half a day - and it was also 
interactive, which helped a lot when trying to track down inconsistent 
behaviours (Python comes with a nice interactive shell).

And that's about it, from my personal perspective. YMMV.

--
D.



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

Date: Mon, 14 Oct 2002 16:58:13 +0200
From: Andreas Huber <ah@datapharm.de>
Subject: XWhois parsing denic-format => RegEx
Message-Id: <3DAADB85.FE26C3A9@datapharm.de>

Hi,

I have a problem parsing the whois information for denic format.
The parser in XWhois is not good. How can I parse the admin-c in the
example below?
with my parser, I get only the first line, first value (for this here:
PERSON). But I need all the
information for admin-c without key field. I think its only a
RegEx-problem...

Please help!!!

my parser is:
######################################
$w->register_parser (
 Name => "DENIC",
 Retain => 1,
 Parser => {
  contact_admin => '\[admin-c\]\n.*?(?=.*?:\s+(.*?)\s)\n\n'
 }
);
#######################################


denic:
######################################
domain:      denic.de
descr:       DENIC eG
descr:       Wiesenhuettenplatz 26
descr:       60329 Frankfurt
descr:       DE
nserver:     dns3.denic.de 194.246.96.25
nserver:     dns6.denic.de 194.246.96.113
nserver:     dns14.de.net
nserver:     sss-at.denic.de 193.171.255.34
nserver:     xlink1.xlink.net
status:      connect
changed:     20020714 160749
source:      DENIC

[admin-c]
Type:         PERSON
Name:         Sabine Dolderer
Address:      DENIC eG
Address:      Wiesenhüttenplatz 26
City:         Frankfurt
Pcode:        60329
Country:      DE
Changed:      20010912 224958
Source:       DENIC

[tech-c][zone-c]
Type:         ROLE
Name:         DENICoperations
Address:      DENIC eG
Address:      Wiesenhüttenplatz 26
City:         Frankfurt
Pcode:        60329
Country:      DE
Phone:        +49 69 27235-272
Fax:          +49 69 27235-234
Email:        ops@denic.de
Remarks:      Information: http://www.denic.de
Remarks:      Questions: mailto:ops@denic.de
Remarks:      Tel.: 0180 2336420 (pro Anruf 1 Gebuehreneinheit)
Remarks:      DENICoperations at the
Remarks:      German Network Information Center (DENIC)
Remarks:      Top Level Domain for Germany (.de)
Changed:      20010912 225557
Source:       DENIC
#######################################################




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

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


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