[13142] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 552 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 16 08:08:36 1999

Date: Mon, 16 Aug 1999 05:05:08 -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, 16 Aug 1999     Volume: 9 Number: 552

Today's topics:
    Re: Accessing $#array if array not declared (Anno Siegel)
    Re: Active state perl and IIS3 mixed asp/perl environme (Maurice Walshe)
        automatic text formatting for 80 chars a line <m.scheferhoff@gmx.de>
    Re: Creating hotlinks out of plain URLs in Perl. <mike@crusaders.no>
    Re: get data from flat file (I.J. Garlick)
    Re: get data from flat file (I.J. Garlick)
    Re: HARASSMENT -- Monthly Autoemail <I.Clarke@strs.co.uk>
    Re: HARASSMENT -- Monthly Autoemail <I.Clarke@strs.co.uk>
        Parsing flat file v's MSQL with a Perl CGI script <Paul.Foran@analog.com>
        parsing tecnique <mcmike123@worldnet.att.net>
    Re: Perl data type size (max and min values) (Anno Siegel)
    Re: perl shipped with RH 6.0 not properly compiled (I.J. Garlick)
    Re: problem printing ("html") <flavell@mail.cern.ch>
        Referencing Questions <matthew_j_forder@notes.seagate.com>
    Re: RegExp question (Anno Siegel)
        Retrieving TEXTAREA information using CGI (post method) <bholness@nortelnetworks.com>
    Re: Retrieving TEXTAREA information using CGI (post met (Graham Ashton)
    Re: Wacky Programming Tales <mike@crusaders.no>
    Re: Why use Perl when we've got Python?! <amaranda@spider.com>
    Re: Why use Perl when we've got Python?! <meowing@banet.net>
    Re: Why use Perl when we've got Python?! <I.Clarke@strs.co.uk>
    Re: Why use Python when we've got Perl? <I.Clarke@strs.co.uk>
    Re: Why use Python when we've got Perl? <rra@stanford.edu>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 16 Aug 1999 09:41:09 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Accessing $#array if array not declared
Message-Id: <7p8mbl$1gp$1@lublin.zrz.tu-berlin.de>

 <marcza@my-deja.com> wrote in comp.lang.perl.misc:
>Suppose:
>
># @lines = ("a", "b", "c");
>print "ARR=$#lines\n";  # gives ARR=-1
>$ind = 0;
>while ($ind <= $#lines)
>   {  ... }
>
>The content of $#lines is just before the while loop
>-1 because the array is undefined. Therefore the loop should not be
>entered. Surprisingly it ENTERS the loop ! Why ?

Sorry, but I don't believe you.  You are posting code you didn't run.

Anno


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

Date: Mon, 16 Aug 99 11:04:11 GMT
From: maurice.walshe@bt.com (Maurice Walshe)
Subject: Re: Active state perl and IIS3 mixed asp/perl environment
Message-Id: <7p8rfl$stj$1@pheidippides.axion.bt.co.uk>

In article <37B33359.89CF6D87@mail.cor.epa.gov>, David Cassell <cassell@mail.cor.epa.gov> wrote:
>Jon Peterson wrote:
 
>> Maurice Walshe <maurice.walshe@bt.com> wrote:
 
>> > I am trying to improve performance as the server is slow - due to NDA
 

>> Hi. It is quite possible that it is the CGI overhead in launching the perl
>> scripts that is causing the problem. If you don't want to use ActiveState's
>> solutions to this (they have some, but they may well require IIS4 and rather
>> tight integration), then Velocigen's product may help you:
 
>Actually this is one of a number of options.  You can also
>check out FastCGI, PerlEx from ActiveState, and a couple other
>options which are discussed in the Perl FAQ.  If you don't have
>a copy of the Perl FAQ, then you really ought to upgrade your
>version of Perl [at least a private version if nothing else],
>becaue it and a *lot* of other helpful docs come with it.
>For free.

Hmm

That will be the perl32 faq that is missing from perl.com then :-)

However the problem is in the asp/perl interaction more than
perl itself - Late last week I did some timeing tests and
the problem is not with perl but with (guess what) the ASP Spit ;-(

Thanks for your responses.

Rgds M

------------------------------------------------------------------------------
|Maurice Walshe               You'll Never Get to heaven with an Ak47,       |
|Software Engineer            But A Zu 30's excelent for low flying Cherubim |
|Digita Media Services                                                       |
|maurice.walshe@bt.com <http://www.dms.bt.com>                               |
|  Not an official Statement of BT's or DMS's Views unless explicity stated  |
|-----------------------------------------------------------------------------


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

Date: Mon, 16 Aug 1999 14:00:18 +0200
From: Michael Scheferhoff <m.scheferhoff@gmx.de>
Subject: automatic text formatting for 80 chars a line
Message-Id: <37B7FD51.7F4F8A76@gmx.de>

Hello,

does anybody know how to format a text so that I have 80 characters in a
line. Is there a command for this?

Thanks,

Michael



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

Date: Mon, 16 Aug 1999 11:28:06 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: Re: Creating hotlinks out of plain URLs in Perl.
Message-Id: <TQQt3.87$ty5.723@news1.online.no>


Abigail <abigail@delanet.com> wrote in message
news:slrn7revll.8e5.abigail@alexandra.delanet.com...
> Sunfox (sunfox@sunwerx.com) wrote on MMCLXXV September MCMXCIII in
> <URL:news:evIt3.105906$U42.135154@news1.rdc1.bc.home.com>:
> \\
> \\ Wow, that's quite impressive... and it works! Amazing! Now, one further
> \\ question: is there any way to detect if the <A HREF= part is already in
a
> \\ particular URL and not do anything in that case? Lastly, is there a
> \\ formatted version of this anywhere? I'm trying to remove those that I
don't
> \\ really need (what's vemmi:// or prospero://?) but as it's all run
together
> \\ it's a tad hard.
>
> You would need to parse the HTML if you want to exclude URL in HREFs.
> (I guess you want to exclude them from <IMG>, <LINK>, <OBJECT> and
>  everything else that can contain URLs as well.)
>
> As for a formatted version, no, not really. But here's the code that
> created the regex:

Wow! I've gotta save this one..

> # HTTP
> my $hsegment       =  "(?:(?:${uchar}|[;:\@&=])*)";
> my $search         =  "(?:(?:${uchar}|[;:\@&=])*)";
> my $hpath          =  "(?:${hsegment}(?:/${hsegment})*)";
> my $httpurl        =
"(?:http://${hostport}(?:/${hpath}(?:${qm}${search})?)?)";

But I missed the HTTPS URL, so I changed this to ...https?://...

--
Trond Michelsen





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

Date: Mon, 16 Aug 1999 08:54:04 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: get data from flat file
Message-Id: <FGJvE5.qG@csc.liv.ac.uk>

In article <37B32759.B4E26840@cisco.removethis.com>,
Makarand Kulkarni <makkulka@cisco.REMOVETHIS.com> writes:
> You need to use arrays instead of scalars $username and $password
> if you expect to find a match on multiple lines.

True, but a total red herring.

[useless example snipped]

-- 
Ian J. Garlick
ijg@csc.liv.ac.uk

People often find it easier to be a result of the past than a cause of
the future.



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

Date: Mon, 16 Aug 1999 09:20:25 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: get data from flat file
Message-Id: <FGJwM1.1CA@csc.liv.ac.uk>

In article <37B31BC1.19954DAB@1185design.com>,
mikej <mikej@1185design.com> writes:

[.....]

> if the person submitting the form enters "client3" then it should
> display "username3" and "password3" for the results page. The problem is
> it only works for the first line. Heres what I have for the main part of
> the script:
> 
> $clientname = $file_form{'name'};

Hmmmmmm.... This looks like cargo cult CGIing. I suspect this is the root
of all your problems as when I try your code it works for me.

> #extract username and password from password.log file
> 
>  open(LOG, "password.log") || &error("Couldn't open log file \n\n$!");

I do hope that &error sub routine die's somewhere in it (after printing a
suitable HTML error message of course) or your gonna regret it.

Why do it this way?

>  @indata = <LOG>;
>  close(LOG);
>  
>  foreach $line (@indata)
>      {
>      chomp($line);
>      ($data_name, $data_username, $data_password) = split(/\|/, $line);
>      if ($data_name eq $clientname) {
>         $username = "$data_username";
>         $password = "$data_password";
>         }
>      }

All of above can be replaced with this
my @line;
while (<LOG>) {
   chomp;  
   @line = split /\|/;
   last if $line[0] eq $clientname;
}
close LOG;

There are probably more optimizations, (I never could get the hang of
putting the chomp in the while expression).

It also has the possibility of being quite a bit faster for certain values
of clientname. No sorry strike that, for all values of clientname except
probably the last entry in password.log.

> 
> #print results
> 
>    print "Content-type:text/html\n\n";

Yeukkk. [ugly print statements snipped]

print <<EOF;
Content-type:text/html

<html><head><title>query results</title></head>
<body bgcolor= \"#FFFFFF\">
<B>Client:</B> $clientname<BR><BR>
<B>Username:</B> $line[1]<BR>
<B>Password:</B> $line[2]<BR>
</body></html>
EOF

Using here docs notation is more conventional around here for multiple
lines of output.

> Does anyone see anything wrong?

I tried your original code (from the command line with a DATA statement)
and it works fine, finds client2, 3, or 4.

I also tried my modified version which works also.

In conclusion, you are not getting what you think you are from the
password.log file, or more likely whatever you are using for your CGI code
to get $file_form{'name'} is severely broken.

Try replacing it with

use CGI;
my $query = new CGI;
my $clientname = $query->param('name');

If you are able to (ie CGI is available to you on your system, should be
on any complete modern version of perl). If it's not available upgrade or
get a new ISP.

-- 
Ian J. Garlick
ijg@csc.liv.ac.uk

People often find it easier to be a result of the past than a cause of
the future.



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

Date: Mon, 16 Aug 1999 11:09:45 +0100
From: Ian Clarke <I.Clarke@strs.co.uk>
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <37B7E369.39F7B730@strs.co.uk>


> Join the usenet discussion properly, and there'll be no emails needing
> to be blocked.  news.announce.newusers isn't there for decoration.

And what does news.announce.newuser say about flaming people for poor
spelling, grammar etc?  Perhaps Tom should take a look at that too.

Ian.


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

Date: Mon, 16 Aug 1999 11:15:17 +0100
From: Ian Clarke <I.Clarke@strs.co.uk>
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <37B7E4B5.6D727879@strs.co.uk>


> I apologize for the rather harsh tone my follow-up has taken.
> But sometimes I get a mite peeved at the modern notion that
> people ought to be allowed to behave in any anti-social manner
> they like and that somehow anybody who attempts to correct their
> behaviour is at fault.

Sending a regular unsolicited email to someone, which has the clear
intention to annoy rather than inform, IS a world apart from not
following the letter of the law (and I use that word with all implied
irony) regarding posting.

Tom should grow up, and those defending him should show some backbone.

Ian.


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

Date: Mon, 16 Aug 1999 12:37:39 +0100
From: Paul Foran <Paul.Foran@analog.com>
Subject: Parsing flat file v's MSQL with a Perl CGI script
Message-Id: <37B7F803.EEEC6D1B@analog.com>

Can somebody give me the disadvantages of accessing a text file instead
of a database. My CGI script at  present parses the contents of a
character seperated database table text file. what are the advantages in
imorting this text file into msql and getting my script to query a MSQL
database table instead. My script simply is listing the contents of
about 30 entries max. It has about 5 cols.
regards,
       Paul.





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

Date: Mon, 16 Aug 1999 07:48:50 -0400
From: "mike" <mcmike123@worldnet.att.net>
Subject: parsing tecnique
Message-Id: <7p8tpk$coc$1@bgtnsc01.worldnet.att.net>

Whare can i learn about parsing an html document, for the " <a href "
statments?

lets say i have an HTML page within a HTML page like so;

<html><head>
<title>html page of links</title></head>
<body>

 <html><head>
<title>html page source</title></head>
<body>

garbage garbage garbage garbage garbage garbage
garbagegarbagegarbage garbage garbage garbage

<--this is what i want to keep-->

<a href="http://www.mikegaskill.com/"><b>Sacramento Real Estate - Mike
Gaskill</b></a><dd>
Real Estate and homes for sale in Sacramento, Elk Grove, El Dorado Hills,
Folsom, Rancho Murieta and...<br><b>URL:</b> <font
color=gray>www.mikegaskill.com/<br>

is this possible to do?

garbage garbagegarbagegarbage garbage garbage
garbage garbage garbage garbage garbage garbage
</body></html>

</body></html>

thank you
mike




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

Date: 16 Aug 1999 09:27:11 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl data type size (max and min values)
Message-Id: <7p8lhf$1f6$1@lublin.zrz.tu-berlin.de>

Abigail <abigail@delanet.com> wrote in comp.lang.perl.misc:
>Steve (steve@nomail.com) wrote on MMCLXXVI September MCMXCIII in
><URL:news:37B77CA1.115C205A@nomail.com>:
>** Hi all, got a pretty simple Perl question here.
>** 
>** How can I determine the maximum and minimum value of a scalar value?
>** Or, what is the size of a scalar.  I can\x92t seem to find this information
>** in Larry Wall\x92s Programming Perl or the online perl.com documentation.
>** 
>** Please respond via newsgroup only (email is not valid to avoid junk
>** mail).
>
>If you put down a silly email address, I might give you a silly answer.
>BTW, you have illegal characters in your post.
>
>
>Here's one way to find out:
>
>     my  $j = my $i = 0;
>     do {$j =    $i ++} until $i =~ /Inf/;
>     print "The maximum value of a scalar is: $j\n";

      my ( $v, $n, $e ) = split m/\.|e/, $j;
      my $jp1 = join '', $v, $n, '0' x ( $e - 1 - length $n), '1';
      print "...and the value of this scalar is one more: $jp1\n";

Anno

PS: Why initialize $j?


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

Date: Mon, 16 Aug 1999 10:54:38 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: perl shipped with RH 6.0 not properly compiled
Message-Id: <FGK0z2.36o@csc.liv.ac.uk>

In article <37B6B627.B3340728@bivio.com>,
lichtin@bivio.com writes:
> After a fresh Redhat 6 installation, the symptom is

[....]

> Has anyone else noticed this? I just couldn't find anything
> about this problem in the usual places (deja,redhat,perl).com, etc

Can't say for RH6 but when I installed RH5.0 (I think) perl was
deffinately broken. Nothing I did or could find would make it work.

So I did the obvious (to me) downloaded latest available Perl and compiled
it myself. Works a dream now.

I know 2 users don't necessarily make it a fact but judging from lurking
here for a while now the version of perl that unpacks from the RH rpms may
be faulty.

Then again I could be talking BS. But that was my experience.

-- 
Ian J. Garlick
ijg@csc.liv.ac.uk

People often find it easier to be a result of the past than a cause of
the future.



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

Date: Mon, 16 Aug 1999 11:53:05 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: problem printing ("html")
Message-Id: <Pine.HPP.3.95a.990816115156.25501E-100000@hpplus03.cern.ch>

On Mon, 16 Aug 1999, elephant wrote:

> Alan J. Flavell writes ..
> >On Sun, 15 Aug 1999 inlandpac@my-deja.com wrote:
> >> It is #!usr/local/bin/perl, not #!usr/bin/perl
> >
> >How can you be so sure of that?  Do you use the same system?
> >You might be right, but then again, I think if they follow the usual FAQ
> >steps they're more likely to (a) get the right answer and (b) understand
> >the answer that they got.
> 
> and (c) use an absolute path for their shebangs instead of the relative 

You bet.  How on earth did I overlook the fact that the leading slash
was missing on both of them?  Sheesh.  Thanks for stepping in!




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

Date: Mon, 16 Aug 1999 09:25:44 GMT
From: Matthew Forder <matthew_j_forder@notes.seagate.com>
Subject: Referencing Questions
Message-Id: <7p8leh$p52$1@nnrp1.deja.com>

I have a questions to do with referencing varibles in Perl, I suspect
the answer is fairly straight forward, but I just can't seem to
understand referencing properly, so I need your help!

I'm trying to write a small module, and in this module there is a
constructor which returns a blessed reference to an anonymous hash. This
all works fine, and I can populate the hash no problem.

There is also a method in the module which opens an INET socket on
another machine, like so:

sub openSock {
  my ($self) = shift;

  # open a socket connection to the server
  $self->{'filehandle'} = IO::Socket::INET->new(
    Proto    => 'tcp',
    PeerAddr => $self->{'server'},
    PeerPort => $self->{'port'}
    ) or die "Couldn't connect to SeaRCS server: $!\n";
  $self->{'filehandle'}->autoflush(1);
}

as you can see, I store the returned socket FileHandle as part of the
anonymous hash. This works fine as well, but the problem come when I
need to use the FH which has been stored.

In the main code of the perl program, I create a instance of my object,
and open the socket. Now I need to use the FH to listen and send, I
think I should be able to do this:

print $instance->{'filehandle'} "socket message\n";
$reply <$instance->{'filehandle'}>;

but, perl doesn't like it. I have found (through trial and error) that I
send using:

print { $instance->{'filehandle'} } "socket message\n";

but this doesn't work when trying to read.

If anyone can help, or at least nudge me in the right direction, I would
be very greatful.

Thanks and regards,

Matthew Forder
Unix System Admin.
Seagate Technology International.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 16 Aug 1999 11:55:37 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: RegExp question
Message-Id: <7p8u7p$1n7$1@lublin.zrz.tu-berlin.de>

 <marcza@my-deja.com> wrote in comp.lang.perl.misc:
>I want to find out a regexp which inserts a "0" if the day or the month
>of a date is only a single digit:
>
>$mydate1 = "2.12.1999"; # should give "02.12.1999"
>$mydate2 = "7.2.1999";  # should give "07.02.1999"
>$mydate3 = "03.4.1999";  # should give "03.04.1999"
>
>I could do that with two replacement statement. But this must go within
>one line.
>
>With two:
>$mydate1 =~ s/^([1-9])\./0$1\./eg;
>$mydate1 =~ s/\.(1-9])\./\.0$1\./eg;

Again you posted code you didn't run.  Let's see what's wrong
with your substitutions:

- The /e modifier in both substitutions.  They give you runtime
  errors.
- A missing [ in the second substitution.  It will never do anything
  to the dates you supply.
- The \. escapes in the substitution parts.  The are not needed and
  make things harder to read.
- The /g modifier in both substitutions.  Each one can only match
  once, so it's misleading.

Please, if you want a discussion of your code, *run* it, and then
use cut and paste or some other foolproof means to insert it in
your post.  This would have eliminated at least two of your errors.

It is certainly possible to find a regex substitution that does what
you want, but as you have probably seen when you tried, it isn't very
straightforward.  It is easier and clearer to use sprintf to format
the numbers as needed.  This is easily done in a single line:

$mydate = join '.', map sprintf( '%02d', $_), split m/\./, $mydate;

Anno


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

Date: Mon, 16 Aug 1999 11:47:00 +0100
From: "Ben Holness" <bholness@nortelnetworks.com>
Subject: Retrieving TEXTAREA information using CGI (post method)
Message-Id: <7p8q8f$pdp$1@bcrkh13.ca.nortel.com>

Hi all,

How do I get information from a <TEXTAREA> when the form method is POST,
using CGI? (the param function doesn't appear to work).

Many thanks,

Ben




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

Date: 16 Aug 1999 11:06:31 GMT
From: billynospam@mirror.bt.co.uk (Graham Ashton)
Subject: Re: Retrieving TEXTAREA information using CGI (post method)
Message-Id: <slrn7rfs5o.v2f.billynospam@wing.mirror.bt.co.uk>

In article <7p8q8f$pdp$1@bcrkh13.ca.nortel.com>, Ben Holness wrote:
>
>How do I get information from a <TEXTAREA> when the form method is POST,
>using CGI? (the param function doesn't appear to work).
>
>Many thanks,

What do you expect us to do? You've not given us enough info, for
starters. I don't mean to be rude, but if you can't be bothered to post
a decent description of your problem (i.e. code) then people can't help
you.

-- 
Graham


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

Date: Mon, 16 Aug 1999 11:05:49 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: Re: Wacky Programming Tales
Message-Id: <%vQt3.77$ty5.693@news1.online.no>


Kaz Kylheku <kaz@ashi.FootPrints.net> wrote in message
news:slrn7re808.77t.kaz@ashi.FootPrints.net...
> On 15 Aug 1999 03:14:48 GMT, Ben Caradoc-Davies <bmcd@es.co.nz> wrote:
> >[strange programming]
> > i = 0;
> > while( i < max_index ) {
> > /* some copying or update (not modifying i) goes here */
> > i = i + 1;
> > }
> So what's wrong with that? Granted, the for loop construct would have
> been better for the task instead of while, and the expensive consultant
should
> have seen that. But what about the i = i + 1 increment? It smacks of
BASIC, but
> there is nothing wrong with it.  It's not any less efficient than i++ or
++i.

How about this foreach loop for wackyness then?

-----------8<------------------
  $CONF{timetolive}=1 if($CONF{timetolive}<1);
  my @time=localtime(time-(60*60*24*$CONF{timetolive}));
  @time[4]++;
  @time[5]+=1900;
  $i=0;
  foreach (@time) {
    if(length(@time[$i])<2){
      @time[$i]="0".@time[$i];
    }
    $i++;
  };
-----------8<------------------

IMO, there is an impressive error to line ratio in this piece.


--
Trond Michelsen





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

Date: Mon, 16 Aug 1999 10:33:36 +0100
From: Alex Maranda <amaranda@spider.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37B7DAF0.3198@spider.com>

Sam Holden wrote:
> I know a fair few pythoners in fact, I even like some of them. What I meant
> was that anyone who would do such a thing with perl deserves to be killed.
That's the only bit which bothers me; would you put your oppinions in
practice given the chance? (morality and law put aside of course :-)

> Also don't tell anyone but I actually like python a lot. I don't use it much
> since I have more experience with perl, and more importantly I know the
> modules available for perl better, and can quickly search for one to
Get a copy (it's worth printing out, believe me) of the 'Python Library
Reference'.
> do whatever I need next.
That's good to hear. Perhaps you're in the position (or will be in time)
to make a fair comparison between Perl and Python, as coming from an
experienced and unbiased Perl programmer. The same comparison done from
the other side of the mirror (i.e. Python) would be great also. And best
of all, surveys ref what are the language(s) used for and not only how
many people are in each camp...

> >> use impythonate; # STILL NEED THAT ONE SEMICOLON, DAMMIT!
> >>
> >> for $i (1..10)  # COMMENTS ARE OKAY
> >>   print "$i: "
> >>   my $isq =  \
> >>   $i **2 # LINE CONTINUATIONS WORK AS IN PYTHON
> >>   print " $isq\n"
> >>
> >> print "done\n"
> >I know Python fairly well (but I'm no expert) and I can easily read this
> >piece of Perl.
> 
> But it would be no harder to read with ; on the end of each statement and
> a pair of {}s.
Fair enough; the loop is so simple I would understand it in COBOL also
(no, I don't know COBOL :-)

> 
> Working out that strings interpolate should be a bigger leap than working
> out that blocks have {}s around them.
If this all impythonate is doing it's not worth the trouble of course.

> Everyone seems to misunderstand the whole concept of TMTOWTDI. It doesn't
> mean all ways are equal. That is a way of writing perl which works, it is
> however not very maintanable. The only way to determine what syntax is
> valid is to know perl's syntax, and to be able to read and understand the
> impythonate.pm code - since there is no documentation and it is _not_ the
> same as python.
> 
> Writing it in 'normal' perl reduces the requirements to understanding, and
> speeds it up to boot.
Fair enough again; I misread your post (or I read to much into it), and
I thought you're against Python's syntax and whitespace in general. If
it doesn't make sense for Perl, that's fine with me.

> >A couple of days ago I read a bit in Bugzilla's README which amused me:
> >"A computer which doesn't have Perl installed is a very sad computer
> >indeed". Your post is frightening (unless it was a Perl-style joke).
> 
> How was it frightening?
I don't follow comp.lang.perl.* so I don't know what's accepted behavior
there. Imagine my shock when encountering the word 'kill' as punishment
for programming in Python style, when reading my favorite newsgroup.

Regards (no doubts this time),
Alex


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

Date: 16 Aug 1999 06:55:57 -0400
From: gja <meowing@banet.net>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <87d7wouh8i.fsf@banet.net>

John Stevens <jstevens@bamboo.verinet.com> wrote:

> Yes?  There is a sig:

> #!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
> $^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
>  00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
> rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print

> So, tell me, in thirty seconds or less, and without refering to a
> reference manual, what this does?  If you
> wrote this, or have ever seen it before, this test is invalid.

So, tell me, in fifteen seconds or less (discounting for Python's
inherent brevity and clarity, of course) what this does.  It
demonstrates one of the more interesting properties of a metric
frequently "discussed" in another newsgroup I read.

#!/usr/local/bin/python
import string,math;BI=20;v=BI/BI;n=BI*BI/(BI<<v);y=int(math.sqrt(n));n=n*n;
w=v+n+(v<<y);x=n+v;y=w+(v<<v);z=w+y-x;print string.join(map(chr,(w,x,y,z)),'')


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

Date: Mon, 16 Aug 1999 12:23:18 +0100
From: Ian Clarke <I.Clarke@strs.co.uk>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37B7F4A6.1020543D@strs.co.uk>

[snip]
> Yes. You've made your point that you suck as a programmer very clear.
[snip]
> Which says a lot about you, and nothing about Perl.
[snip]
> We've seen your 4 line Python code. We've seen it not work. You would
> also need the "Python Quick Reference Card". Just because you suck as
> a programmer doesn't mean programming languages are bad.
[snip]
> Replace your memory.

I must say that I am getting really sick of the Python advocates being
accused of flaming, when I have yet to see a single comment in defence
of Python which resorted to personal insults.

As can be seen from this post, and many others, the Perl regulars have
no such qualms.

Ian.


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

Date: Mon, 16 Aug 1999 11:02:20 +0100
From: Ian Clarke <I.Clarke@strs.co.uk>
Subject: Re: Why use Python when we've got Perl?
Message-Id: <37B7E1AC.FF4FF2CF@strs.co.uk>


> The problem in comp.lang.perl.misc is not the beginners -- it is
> the regulars.

I agree completely.  As the person who started this whole thing
(sheepish grin) the regulars, Tom in particular, has been rude, and
resorted to personal insults on a number of occasions, even while I
remained calm and polite.  He repeatedly accuses me of being a troll and
inciting flames (despite the fact that he was the only one flaming!). 
To top it all off, having posted numerous "courtesy" copies of his
newsgroup postings to my email address, to which I replied on-subject
and politely, he then emailed me an email saying that I had been
killfiled!  A rather pathetic way to get the last word in my opinion.

Lucky I do not judge Perl on the quality of their newsgroup regulars.

Ian.


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

Date: 16 Aug 1999 03:42:43 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Why use Python when we've got Perl?
Message-Id: <ylso5kqa58.fsf@windlord.stanford.edu>

In comp.lang.perl.misc, Ian Clarke <I.Clarke@strs.co.uk> writes:

> I agree completely.  As the person who started this whole thing
> (sheepish grin) the regulars, Tom in particular, has been rude, and
> resorted to personal insults on a number of occasions, even while I
> remained calm and polite.  He repeatedly accuses me of being a troll and
> inciting flames (despite the fact that he was the only one flaming!).

However rude Tom has been, apply a little bit of logic to what you're
doing.  Crossposting between Python and Perl newsgroups is inciting
flames.  Starting threads with the topic "Why use Python when we've got
Perl?" or "Why use Perl when we've got Python?" or the like is inciting
flames.  Starting threads about Python in a Perl newsgroup or Perl in a
Python newsgroup is inciting flames.

Sometimes it's worth putting up with the flames in order to make a point
or to get some useful information, and I think there's been some useful
and interesting information in this thread.  But please take some personal
responsibility for your actions.

comp.lang.perl.misc is primarily for talking about Perl, not trying to
defend Perl to a Python advocate.  I'm sure the converse is true of
comp.lang.python.  Someone who starts a language advocacy flamewar and
then plays innocent about it isn't exactly holding the moral high ground.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu. 

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 V9 Issue 552
*************************************


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